python - Django WGSI paths -
i having problems setting wgsi django. i'm following http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/ . yet still confused put .wsgi file , if need set sys.path. have tried both directly outside , inside web root , can't work expected.
# /home/ben/public_html/django_test/testproject/apache/django.wsgi: import os import sys os.environ['django_settings_module'] = 'testproject.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.wsgihandler()
relivant apache conf:
documentroot "/home/ben/public_html/django_test/testproject/" wsgiscriptalias / "/home/ben/public_html/django_test/testproject/apache/django.wsgi"
apache logs error (standard apache 500 page):
importerror: not import settings 'testproject.settings' (is on sys.path? ...
i can @ django @ least throw error of it's own using this:
import os import sys path = '/home/ben/public_html/django_test/testproject' if path not in sys.path: sys.path.append(path) os.environ['django_settings_module'] = 'settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.wsgihandler()
which resulted in django error page:
importerror @ /admin/ no module named testproject.urls
i put wsgi @ same level settings.py, , looks this:
import os import sys sys.path.insert(0,os.sep.join(os.path.abspath(__file__).split(os.sep)[:-2])) os.environ['django_settings_module'] = 'yourprojectname.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.wsgihandler()
this apache conf file:
namevirtualhost *:80 <virtualhost *:80> serveradmin webmaster@localhost servername www.yourprojectname.com alias /media/ /home/diegueus9/workspace/yourprojectname/media/ <directory /home/diegueus9/workspace/yourprojectname/media/> order deny,allow allow </directory> wsgiscriptreloading on wsgidaemonprocess yourprojectname wsgiprocessgroup yourprojectname wsgiapplicationgroup yourprojectname wsgipassauthorization on wsgiscriptalias / /home/diegueus9/workspace/yourprojectname/yourfile.wsgi errorlog /var/log/apache2/yourprojectname-error.log # possible values include: debug, info, notice, warn, error, crit, # alert, emerg. loglevel debug customlog /var/log/apache2/yourprojectname-access.log combined </virtualhost>
Comments
Post a Comment