Add GZip compression
This commit is contained in:
parent
43d4e9a825
commit
347143ab44
1 changed files with 2 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
|
from fastapi.middleware.gzip import GZipMiddleware
|
||||||
from fastapi.responses import HTMLResponse, PlainTextResponse
|
from fastapi.responses import HTMLResponse, PlainTextResponse
|
||||||
from fastapi import FastAPI, Form, Response
|
from fastapi import FastAPI, Form, Response
|
||||||
import jinja2
|
import jinja2
|
||||||
|
@ -15,6 +16,7 @@ from . import __version__
|
||||||
basedir = os.path.dirname(__file__)
|
basedir = os.path.dirname(__file__)
|
||||||
|
|
||||||
app = FastAPI(openapi_url=None)
|
app = FastAPI(openapi_url=None)
|
||||||
|
app.add_middleware(GZipMiddleware)
|
||||||
app.mount("/static", StaticFiles(directory=basedir + "/static"), name="static")
|
app.mount("/static", StaticFiles(directory=basedir + "/static"), name="static")
|
||||||
|
|
||||||
template_env = jinja2.Environment(
|
template_env = jinja2.Environment(
|
||||||
|
|
Loading…
Reference in a new issue