2024-03-05 14:45:22 +08:00
|
|
|
from flask import Flask
|
|
|
|
|
|
|
|
|
|
|
|
def init_app(app: Flask):
|
2024-08-15 12:54:05 +08:00
|
|
|
if app.config.get("API_COMPRESSION_ENABLED"):
|
2024-03-05 14:45:22 +08:00
|
|
|
from flask_compress import Compress
|
|
|
|
|
2024-08-15 12:54:05 +08:00
|
|
|
app.config["COMPRESS_MIMETYPES"] = [
|
|
|
|
"application/json",
|
|
|
|
"image/svg+xml",
|
|
|
|
"text/html",
|
2024-03-26 10:11:43 +08:00
|
|
|
]
|
|
|
|
|
2024-03-05 14:45:22 +08:00
|
|
|
compress = Compress()
|
|
|
|
compress.init_app(app)
|