, ,
:
, , print get_context_data() :
File "/home/ubuntu/workspace/neurorehabilitation-system/userprofile/views.py" in get_context_data
50. print (user.is_physiotherapist)
, , , stdout amazon ec2.
git gunicorn, .
DEBUG=True
:
settings/
base.py # --- without DEBUG
development.py # --- DEBUG=True
testing.py # --- DEBUG=True
production.py # --- DEBUG=False
staging.py # --- DEBUG=False
(development.py, testing.py, production.py, staging.py) base.py
, ec2, execute.py , base.py DEBUG False.
, (True False) , ,
(nrb_dev)ubuntu@ip-172-31-27-249:~$ python
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> a=socket.gethostname()
>>> a
'ip-172-31-27-249'
>>>
>>> if a != 'ip-172-31-27-249':
... DEBUG = print ('Caleno juiciocito')
...
>>> DEBUG
True
>>>
, base.py :
import socket
if socket.gethostname() == 'ip-172-31-27-249':
DEBUG = False
else:
DEBUG = True
.
, thar , ,
, , ?
, , , , - DJANGO_SETTINGS_MODULE
virtualenvwrapper, , :
nrb_dev
nrb_test .
, .
nrb_dev $VIRTUAL_ENV/bin/postactivate :
export DJANGO_SETTINGS_MODULE="neurorehabilitation.settings.development"
, nrb_test $VIRTUAL_ENV/bin/postactivate :
export DJANGO_SETTINGS_MODULE="neurorehabilitation.settings.testing"
, Amazon EC2 $VIRTUAL_ENV/bin/postactivate, settings/production.py :
export DJANGO_SETTINGS_MODULE="neurorehabilitation.settings.production"
DEBUG settings/production.py
from .base import *
DEBUG = False
print (DEBUG)
-, , DEBUG False
(nrb_dev)ubuntu@ip-172-31-27-249:~/workspace/neurorehabilitation-system$ gunicorn -c neurorehabilitation/gunicorn_config.py neurorehabilitation.wsgi
[2016-01-08 00:26:15 +0000] [6691] [INFO] Starting gunicorn 19.4.5
[2016-01-08 00:26:15 +0000] [6691] [INFO] Listening at: http:
[2016-01-08 00:26:15 +0000] [6691] [INFO] Using worker: sync
[2016-01-08 00:26:15 +0000] [6694] [INFO] Booting worker with pid: 6694
False
^C[2016-01-08 00:26:19 +0000] [6691] [INFO] Handling signal: int
Django .
, .
:
Ubuntu
Django Nginx, Gunicorn, virtualenv, supervisor PostgreSQL