-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwsgi.py
More file actions
30 lines (22 loc) · 1.06 KB
/
Copy pathwsgi.py
File metadata and controls
30 lines (22 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""WSGI entry point for production deployments.
Run with gunicorn (or any WSGI server) behind a TLS-terminating
reverse proxy::
gunicorn --bind 0.0.0.0:8080 --workers 4 --threads 2 \\
--access-logfile - --error-logfile - \\
wsgi:application
The reverse proxy (nginx, Caddy, ALB) terminates TLS and forwards
``X-Forwarded-Proto``. The factory wires up ProxyFix only when the
operator sets ``QV_TRUSTED_PROXY=1`` so the request scheme is
reconstructed correctly inside Flask.
The Werkzeug dev server is never reachable through this module; that
keeps the public surface small.
"""
import os
# Required for production. Refuse to start without a stable secret.
os.environ.setdefault("QV_ENV", "production")
from app_factory import create_app # noqa: E402
# The gunicorn process import-binds ``application``; the factory call
# runs once at worker boot. There is no global state shared across
# workers beyond the Redis connection and the SQLite file.
application = create_app()
app = application # convenience alias for `flask --app wsgi:app shell`