Login

django_production.wsgi

Author:
vemubalu
Posted:
April 19, 2011
Language:
Python
Version:
1.3
Tags:
django wsgi
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. Overwriting file storage by rbanffy 4 years, 9 months ago
  2. Handy tag for generating URLs to media files by amr-mostafa 7 years, 10 months ago
  3. KMZMiddleware by giovabal 6 years, 10 months ago
  4. Map GPX files to 3D GeoDjango Models by jbronn 5 years, 3 months ago
  5. Fake File Uploads by rfk 6 years, 1 month ago

Comments

Please login first before commenting.