Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an example to demonstrate using a Django setting file as Gunicorn…
… config
- Loading branch information
1 parent
6a3bd70
commit 06c1429
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |