import os sys absFileName os path abspath __file__ projectDir os path

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
import os, sys
absFileName = os.path.abspath(__file__)
projectDir = os.path.dirname(absFileName)
wwwDir,projectName = os.path.split(projectDir)
sys.path.append(wwwDir)
sys.path.append(projectDir)
os.environ['DJANGO_SETTINGS_MODULE'] = projectName+'.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()