optimize mensa async

This commit is contained in:
2024-04-09 11:04:18 +02:00
parent 0d31d84d48
commit ccb088e36d
7 changed files with 66 additions and 48 deletions

13
init.py
View File

@ -2,9 +2,10 @@ from flask import Flask
from flask_login import LoginManager, UserMixin
from flask_sqlalchemy import SQLAlchemy
from flask_talisman import Talisman
from get_mysql import get_mysql
import atexit
#from flask_apscheduler import APScheduler
from flask_apscheduler import APScheduler
def create():
@ -25,7 +26,7 @@ def create():
login_manager.login_view = "login"
# Shut down the scheduler when exiting the app
#atexit.register(lambda: scheduler.shutdown())
atexit.register(lambda: scheduler.shutdown())
@login_manager.user_loader
def load_user(uid: int):
@ -79,11 +80,11 @@ class Meals(db.Model):
schwein = db.Column(db.Boolean)
#scheduler = APScheduler()
scheduler = APScheduler()
app = create()
def_src = ["*.paulmartin.cloud", '\'self\'']
Talisman(app, content_security_policy={"default-src": def_src, "script-src": def_src # + ["'unsafe-inline'"]
})
#scheduler.init_app(app)
#scheduler.start()
#scheduler.api_enabled = True
scheduler.init_app(app)
scheduler.start()
scheduler.api_enabled = True