Make models in package work

This commit is contained in:
Patrick Jentsch
2024-03-06 13:20:02 +01:00
parent a1e5bd61e0
commit 55a62053b0
8 changed files with 56 additions and 1861 deletions

View File

@ -22,6 +22,8 @@ db = SQLAlchemy()
docker_client = DockerClient()
hashids = Hashids()
login = LoginManager()
login.login_view = 'auth.login'
login.login_message = 'Please log in to access this page.'
ma = Marshmallow()
mail = Mail()
migrate = Migrate(compare_type=True)
@ -55,6 +57,9 @@ def create_app(config: Config = Config) -> Flask:
scheduler.init_app(app)
socketio.init_app(app, message_queue=app.config['NOPAQUE_SOCKETIO_MESSAGE_QUEUE_URI']) # noqa
from .models.event_listeners import register_event_listeners
register_event_listeners()
from .admin import bp as admin_blueprint
default_breadcrumb_root(admin_blueprint, '.admin')
app.register_blueprint(admin_blueprint, url_prefix='/admin')
@ -102,11 +107,4 @@ def create_app(config: Config = Config) -> Flask:
from .workshops import bp as workshops_blueprint
app.register_blueprint(workshops_blueprint, url_prefix='/workshops')
login.login_view = 'auth.login'
login.login_message = 'Please log in to access this page.'
from .models.user import User
@login.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
return app