Login

django_production.wsgi

Author:
vemubalu
Posted:
April 19, 2011
Language:
Python
Version:
1.3
Score:
-1 (after 1 ratings)

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

  1. Template tag - list punctuation for a list of items by shapiromatron 2 months, 2 weeks ago
  2. JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 2 months, 3 weeks ago
  3. Serializer factory with Django Rest Framework by julio 9 months, 2 weeks ago
  4. Image compression before saving the new model / work with JPG, PNG by Schleidens 10 months, 1 week ago
  5. Help text hyperlinks by sa2812 11 months ago

Comments

Please login first before commenting.