mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Add an example to demonstrate using a Django setting file as Gunicorn config
This commit is contained in:
parent
6a3bd70d2b
commit
06c1429af7
21
examples/read_django_settings.py
Normal file
21
examples/read_django_settings.py
Normal file
@ -0,0 +1,21 @@
|
||||
"""
|
||||
Use this config file in your script like this:
|
||||
|
||||
$ gunicorn project_name.wsgi:application -c read_django_settings.py
|
||||
|
||||
You need to replace the exec() call if you want it to work on Python 2.
|
||||
"""
|
||||
|
||||
settings_dict = {}
|
||||
|
||||
with open('frameworks/django/testing/testing/settings.py') as f:
|
||||
exec(f.read(), settings_dict)
|
||||
|
||||
loglevel = 'warning'
|
||||
proc_name = 'web-project'
|
||||
workers = 1
|
||||
|
||||
if settings_dict['DEBUG']:
|
||||
loglevel = 'debug'
|
||||
reload = True
|
||||
proc_name += '_debug'
|
||||
Loading…
x
Reference in New Issue
Block a user