2016-02-03 13:21:58 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2016-02-04 19:20:59 +01:00
|
|
|
"""
|
|
|
|
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 = (
|
2016-02-22 12:04:31 +01:00
|
|
|
'%(t)s %(s)s %(L)ss %({Host}i)s "%(r)s" %(b)s "%(f)s"'
|
2016-02-04 19:20:59 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
bind = [
|
|
|
|
env['OPENSHIFT_PYTHON_IP'] + ':' + env['OPENSHIFT_PYTHON_PORT']
|
|
|
|
if _production else
|
|
|
|
_canonical_host
|
|
|
|
]
|
|
|
|
|
|
|
|
chdir = env['OPENSHIFT_REPO_DIR'] if _production else ''
|
|
|
|
|
|
|
|
if _production:
|
2016-02-05 12:54:03 +01:00
|
|
|
pidfile = env['OPENSHIFT_DATA_DIR'] + '/gunicorn.pid'
|