Feature: Switch webserver to granian (#9218)

Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
Trenton H 2025-02-28 11:37:45 -08:00 committed by GitHub
parent 628d85080f
commit 654c9ca273
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 106 additions and 341 deletions

19
webserver.py Normal file
View file

@ -0,0 +1,19 @@
if __name__ == "__main__":
import os
from granian import Granian
from granian.constants import Interfaces
Granian(
"paperless.asgi:application",
interface=Interfaces.ASGI,
address=os.getenv("GRANIAN_HOST") or os.getenv("PAPERLESS_BIND_ADDR", "::"),
port=int(os.getenv("GRANIAN_PORT") or os.getenv("PAPERLESS_PORT") or 8000),
workers=int(
os.getenv("GRANIAN_WORKERS")
or os.getenv("PAPERLESS_WEBSERVER_WORKERS")
or 1,
),
websockets=True,
url_path_prefix=os.getenv("PAPERLESS_FORCE_SCRIPT_NAME"),
).serve()