-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
gunicorn.conf.py
32 lines (26 loc) · 939 Bytes
/
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
"""Gunicorn configuration file."""
from os import environ, path
from dotenv import load_dotenv
# Read environment variables from ".env" file.
basedir = path.abspath(path.dirname(__file__))
load_dotenv(path.join(basedir, ".env"))
# Fetch deployment environment from environment variables.
ENVIRONMENT = environ.get("ENVIRONMENT")
proc_name = "flasksession"
wsgi_app = "wsgi:app"
bind = "unix:flask.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":
daemon = True
accesslog = "/var/log/flasksqlalchemy/access.log"
errorlog = "/var/log/flasksqlalchemy/error.log"
loglevel = "trace"
dogstatsd_tags = "env:prod,service:flasksqlalchemy,language:python"
else:
raise ValueError(f"Unknown environment provided: `{ENVIRONMENT}`. Must be `development` or `production`.")