-
Notifications
You must be signed in to change notification settings - Fork 4
/
gunicorn.conf.py
33 lines (27 loc) · 1.01 KB
/
gunicorn.conf.py
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
31
32
33
"""Gunicorn configuration file."""
from os import environ, path
from dotenv import load_dotenv
# Read environment variables from ".env" file.
BASE_DIR = path.abspath(path.dirname(__file__))
load_dotenv(path.join(BASE_DIR, ".env"))
# Fetch deployment environment from environment variables.
ENVIRONMENT = environ.get("ENVIRONMENT")
proc_name = "pythonmyadmin"
wsgi_app = "wsgi:app"
bind = "unix:pythonmyadmin.sock"
threads = 4
workers = 2
if ENVIRONMENT == "development" or ENVIRONMENT is None:
reload = True
workers = 1
threads = 1
bind = ["127.0.0.1:8000"]
elif ENVIRONMENT == "production":
access_log_format = "%(h)s %(l)s %(u)s %(t)s %(r)s %(s)s %(b)s %(f)s %(a)s"
daemon = True
accesslog = "/var/log/pythonmyadmin/info.json"
errorlog = "/var/log/pythonmyadmin/error.json"
loglevel = "trace"
dogstatsd_tags = "env:production,service:pythonmyadmin,language:python"
else:
raise ValueError(f"Unknown environment provided: `{ENVIRONMENT}`. Must be `development` or `production`.")