Cleanip init.py, utils.py and decorators.py

This commit is contained in:
2025-04-17 13:59:42 +02:00
parent 3b0bc856e9
commit 235072af97
5 changed files with 22 additions and 8 deletions

View File

@@ -20,9 +20,6 @@ db.init_app(app)
migrate = Migrate(app, db)
# bp import
from application.auth.views import auth_blueprint
from application.dash.views import dash_blueprint
# Login manager
from application.auth.models import User
@@ -32,6 +29,7 @@ login_manager.init_app(app) # type: ignore
login_manager.login_view = "auth.login" # type: ignore
# Gets all the user data
@login_manager.user_loader # type: ignore
def load_user(user_id): # type: ignore
return User.query.get(int(user_id)) # type: ignore
@@ -39,5 +37,14 @@ def load_user(user_id): # type: ignore
# Blueprint magic
# bp import
# Would like to do this at the top of the file,
# but can't easily figure out how to do this.
# I think everything that the views depend on have to be moved
# into a seperate .py and imported.
from application.auth.views import auth_blueprint
from application.dash.views import dash_blueprint
# Register blueprints
app.register_blueprint(dash_blueprint, url_prefix="/dash")
app.register_blueprint(auth_blueprint, url_prefix="/auth")