去掉 whitenoise , 使用flask static原生的功能

This commit is contained in:
dami
2026-04-04 21:28:51 +08:00
parent 55d0ebad03
commit 55f7a181cd
2 changed files with 7 additions and 3 deletions
+2 -1
View File
@@ -35,7 +35,7 @@ redis
pillow
Jinja2>=2.11.2
PyMySQL>=1.0.2
whitenoise==5.3.0
whitenoise>5.3.0
tldextract
pyotp
pytz
@@ -49,3 +49,4 @@ packaging
Flask-Compress
brotli
zstd
zstandard
+5 -2
View File
@@ -53,10 +53,13 @@ cache = Cache(config={'CACHE_TYPE': 'simple'})
cache.init_app(app, config={'CACHE_TYPE': 'simple'})
# 静态文件配置
from whitenoise import WhiteNoise
app.wsgi_app = WhiteNoise(app.wsgi_app, root="../web/static/", prefix="static/", max_age=604800)
app.static_folder = "../static"
app.static_url_path = "/static"
app.jinja_env.trim_blocks = True
# from whitenoise import WhiteNoise
# app.wsgi_app = WhiteNoise(app.wsgi_app, root="../web/static/", prefix="static/", max_age=604800)
# session配置
# app.secret_key = uuid.UUID(int=uuid.getnode()).hex[-12:]
app.config['SECRET_KEY'] = uuid.UUID(int=uuid.getnode()).hex[-12:]