Skip to content

Commit daa68f5

Browse files
committed
⚡ LoginPage
0 parents  commit daa68f5

File tree

98 files changed

+70737
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+70737
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# srmmap

app.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from website import create_app
2+
3+
if __name__ == "__main__":
4+
app = create_app()
5+
app.run(debug=True)

cache/b30beb67faa7769d47e54a4c7713c382831996d2.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

instance/Logo1.png

12.1 KB
Loading

instance/database.db

24 KB
Binary file not shown.

website/__init__.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from flask import Flask
2+
from flask_sqlalchemy import SQLAlchemy
3+
from os import path
4+
from flask_login import LoginManager
5+
6+
db = SQLAlchemy()
7+
DB_NAME = "database.db"
8+
9+
10+
def create_app():
11+
app = Flask(__name__)
12+
app.config['SECRET_KEY'] = "helloworld"
13+
app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{DB_NAME}'
14+
db.init_app(app)
15+
16+
from .views import views
17+
from .auth import auth
18+
from .dist import dist
19+
20+
app.register_blueprint(views, url_prefix="/")
21+
app.register_blueprint(auth, url_prefix="/")
22+
app.register_blueprint(dist, url_prefix="/")
23+
24+
from .models import User,Comment
25+
26+
create_database(app)
27+
28+
login_manager = LoginManager()
29+
login_manager.login_view = "auth.login"
30+
login_manager.init_app(app)
31+
32+
@login_manager.user_loader
33+
def load_user(id):
34+
return User.query.get(int(id))
35+
36+
return app
37+
38+
def create_database(app):
39+
if not path.exists("website/" + DB_NAME):
40+
with app.app_context():
41+
db.create_all()
42+
print("Created database!")
2.5 KB
Binary file not shown.
1.25 KB
Binary file not shown.
1.34 KB
Binary file not shown.
4.69 KB
Binary file not shown.

0 commit comments

Comments
 (0)