Django/Mod_WSGI error: UnboundLocalError: local variable 'resolver' referenced before assignment
- by ycseattle
Hello,
I've setup the Django with mod_wsgi and run into this error. I thought maybe the sys.path was not setup correctly but I tried everything I could think of with no luck. Any suggestions?
The following is the apache2 log for the error:
mod_wsgi (pid=2579): Exception occurred processing WSGI script '/home/myapp/myapp.wsgi'.
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 142, in get_response
return self.handle_uncaught_exception(request, resolver, exc_info)
UnboundLocalError: local variable 'resolver' referenced before assignment
The following is the content in the myapp.wsgi:
import os
import sys
# put the Django project on sys.path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
os.environ["DJANGO_SETTINGS_MODULE"] = "photopier.settings"
#os.environ["PYTHONPATH"]="/home"
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()