The above conf file the easiest way to point the env and the settings together , the user has to point the django.wsgi file with the correct path and it should work fine and one can directly run it in apache
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import os, sys
_parent = lambda x: os.path.normpath(os.path.join(x, '..'))
_gparent = lambda x: os.path.normpath(os.path.join(x, '../..'))
DIRNAME = os.path.dirname(__file__)
PROJECT_ROOT = _parent(DIRNAME)
PYTHON_PROJECT_ROOT = _gparent(DIRNAME)
if not _parent(PROJECT_ROOT) in sys.path:
sys.path.append(_parent(PROJECT_ROOT))
if not PROJECT_ROOT in sys.path:
sys.path.append(PROJECT_ROOT)
if not PYTHON_PROJECT_ROOT in sys.path:
sys.path.append(PYTHON_PROJECT_ROOT)
os.environ['PYTHONPATH'] = PYTHON_PROJECT_ROOT
os.environ['DJANGO_SETTINGS_MODULE'] = '<yourprojectname>.settings_production'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
|
More like this
- Template tag - list punctuation for a list of items by shapiromatron 11 months, 2 weeks ago
- JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 11 months, 3 weeks ago
- Serializer factory with Django Rest Framework by julio 1 year, 6 months ago
- Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 7 months ago
- Help text hyperlinks by sa2812 1 year, 7 months ago
Comments
Please login first before commenting.