Functional login and logout, login system should be fucntionally implemented.

Testing and polishing are next.
This commit is contained in:
2026-03-08 22:24:13 +01:00
parent cf4a611231
commit 986629f0a5
13 changed files with 84 additions and 14 deletions
+8 -1
View File
@@ -1,4 +1,5 @@
from flask import Flask
import os
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
@@ -8,8 +9,11 @@ login_manager = LoginManager()
def create_app():
app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = ""
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + os.path.join(BASE_DIR, "app.db")
app.config["SECRET_KEY"] = "dev-secret-key"
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
db.init_app(app)
login_manager.init_app(app)
@@ -17,6 +21,9 @@ def create_app():
from .models.user import User
with app.app_context():
db.create_all()
@login_manager.user_loader
def load_user(user_id):
return db.session.get(User, int(user_id))