Skip to content

Commit f105a8f

Browse files
Berserker66FlySniper
authored andcommitted
WebHost: flask caching doesn't do lazy init anymore (ArchipelagoMW#2155)
1 parent 1443558 commit f105a8f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

WebHost.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
Utils.local_path.cached_path = os.path.dirname(__file__) or "." # py3.8 is not abs. remove "." when dropping 3.8
1616

17-
from WebHostLib import register, app as raw_app
17+
from WebHostLib import register, cache, app as raw_app
1818
from waitress import serve
1919

2020
from WebHostLib.models import db
@@ -40,6 +40,7 @@ def get_app():
4040
app.config["HOST_ADDRESS"] = Utils.get_public_ipv4()
4141
logging.info(f"HOST_ADDRESS was set to {app.config['HOST_ADDRESS']}")
4242

43+
cache.init_app(app)
4344
db.bind(**app.config["PONY"])
4445
db.generate_mapping(create_tables=True)
4546
return app

WebHostLib/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
'create_db': True
5050
}
5151
app.config["MAX_ROLL"] = 20
52-
app.config["CACHE_TYPE"] = "flask_caching.backends.SimpleCache"
52+
app.config["CACHE_TYPE"] = "SimpleCache"
5353
app.config["JSON_AS_ASCII"] = False
5454
app.config["HOST_ADDRESS"] = ""
5555

56-
cache = Cache(app)
56+
cache = Cache()
5757
Compress(app)
5858

5959

0 commit comments

Comments
 (0)