forked from liberapay/liberapay.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
39 lines (29 loc) · 987 Bytes
/
app.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
34
35
36
37
38
39
#!/usr/bin/env python
"""
This module holds our gunicorn settings and launcher.
Docs: http://docs.gunicorn.org/en/stable/settings.html
"""
from os import environ as env, execlp
_canonical_host = env['CANONICAL_HOST']
_production = _canonical_host == 'liberapay.com'
if __name__ == '__main__':
# Exec gunicorn, ask it to read its settings from this file
program = 'gunicorn'
execlp(program, program, 'liberapay.main:website', '--config', 'app.py')
accesslog = '-' # stderr
access_log_format = (
'%(t)s %(s)s %(L)ss %({Host}i)s "%(r)s" %(b)s "%(f)s"'
)
bind = [
env['OPENSHIFT_PYTHON_IP'] + ':' + env['OPENSHIFT_PYTHON_PORT']
if _production else
_canonical_host
]
chdir = env['OPENSHIFT_REPO_DIR'] if _production else ''
if _production:
pidfile = env['OPENSHIFT_DATA_DIR'] + '/gunicorn.pid'
# Import extra settings from the GUNICORN_OPTS env var
import shlex
globals().update(
s.split('=', 1) for s in shlex.split(env.get('GUNICORN_OPTS'))
)