WebHost: flask caching doesn't do lazy init anymore (#2155)

This commit is contained in:
Fabian Dill 2023-09-09 05:02:05 +02:00 committed by GitHub
parent 5368451867
commit 2b9e8fa273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -14,7 +14,7 @@ import settings
Utils.local_path.cached_path = os.path.dirname(__file__) or "." # py3.8 is not abs. remove "." when dropping 3.8
from WebHostLib import register, app as raw_app
from WebHostLib import register, cache, app as raw_app
from waitress import serve
from WebHostLib.models import db
@ -40,6 +40,7 @@ def get_app():
app.config["HOST_ADDRESS"] = Utils.get_public_ipv4()
logging.info(f"HOST_ADDRESS was set to {app.config['HOST_ADDRESS']}")
cache.init_app(app)
db.bind(**app.config["PONY"])
db.generate_mapping(create_tables=True)
return app

View File

@ -49,11 +49,11 @@ app.config["PONY"] = {
'create_db': True
}
app.config["MAX_ROLL"] = 20
app.config["CACHE_TYPE"] = "flask_caching.backends.SimpleCache"
app.config["CACHE_TYPE"] = "SimpleCache"
app.config["JSON_AS_ASCII"] = False
app.config["HOST_ADDRESS"] = ""
cache = Cache(app)
cache = Cache()
Compress(app)