Not sure if this will help, but worth a stab. Check this page: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango I had a similar error and it fixed it for me.
After it tells you how to set up the django.wsgi it says this may not work if you used the Django server to set up your site. Django puts some paths in it that Python doesn't yet have using WSGI. Your situation is a little complicated as I am just getting into Django, but I figured I'd share this document if it may help. Good luck, Mark On Apr 5, 12:46 pm, yongzhen zhang <4...@live.cn> wrote: > Hi, thanks for reply, i have tried this. Now in order to make it > clear, i move the iStore under home, like this: "/home/yongzhen/ > iStore". django.wsgi is inside apache file and the apache file is > under iStore: "/home/yongzhen/iStore/django.wsgi". The content of > django.wsgi: > import os, sys > wsgi_dir = os.path.abspath(os.path.dirname(__file__)) > project_dir = os.path.dirname(wsgi_dir) > sys.path.append(project_dir) > project_settings = os.path.join(project_dir,'settings') > os.environ['DJANGO_SETTINGS_MODULE'] = 'iStore.settings' > import django.core.handlers.wsgi > application = django.core.handlers.wsgi.WSGIHandler() > > and in /etc/apache2/sites-available, there is istore file, i have $ > sudo a2ensite istore. the content of istore: > NameVirtualHost *:80 > > <VirtualHost *:80> > ServerAdmin webmaster@localhost > ServerNamewww.imaboy.cn > ServerAlias shop.imaboy.cn > Alias /static /home/yongzhen/iStore/static > Alias /php /var/www > DocumentRoot /home/yongzhen/iStore > WSGIScriptAlias / /home/yongzhen/iStore/apache/django.wsgi > ErrorLog /var/log/apache2/error.log > LogLevel warn > CustomLog /var/log/apache2/access.log combined > </VirtualHost> > > When i try to openwww.imaboy.cn, here is the error in apache2 > error.log: > [Tue Apr 05 22:43:03 2011] [error] Exception KeyError: > KeyError(-1218787584,) in <module 'threading' from '/usr/lib/python2.6/ > threading.pyc'> ignored > [Tue Apr 05 22:43:03 2011] [error] Exception KeyError: > KeyError(-1218787584,) in <module 'threading' from '/usr/lib/python2.6/ > threading.pyc'> ignored > [Tue Apr 05 22:43:03 2011] [error] Exception KeyError: > KeyError(-1218787584,) in <module 'threading' from '/usr/lib/python2.6/ > threading.pyc'> ignored > [Tue Apr 05 22:43:03 2011] [error] Exception KeyError: > KeyError(-1218787584,) in <module 'threading' from '/usr/lib/python2.6/ > threading.pyc'> ignored > [Tue Apr 05 22:43:03 2011] [error] Exception KeyError: > KeyError(-1218787584,) in <module 'threading' from '/usr/lib/python2.6/ > threading.pyc'> ignored > [Tue Apr 05 22:43:03 2011] [notice] caught SIGTERM, shutting down > PHP Deprecated: Comments starting with '#' are deprecated in /etc/ > php5/apache2/conf.d/mcrypt.ini on line 1 in Unknown on line 0 > [Tue Apr 05 22:43:04 2011] [notice] Apache/2.2.14 (Ubuntu) PHP/ > 5.3.2-1ubuntu4.7 with Suhosin-Patch mod_wsgi/2.8 Python/2.6.5 > configured -- resuming normal operations > [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] mod_wsgi > (pid=8570): Exception occurred processing WSGI script '/home/yongzhen/ > iStore/apache/django.wsgi'. > [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] Traceback > (most recent call last): > [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] File "/usr/ > local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line > 230, in __call__ > [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] > self.load_middleware() > [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] File "/usr/ > local/lib/python2.6/dist-packages/django/core/handlers/base.py", line > 33, in load_middleware > [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] for > middleware_path in settings.MIDDLEWARE_CLASSES: > [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] File "/usr/ > local/lib/python2.6/dist-packages/django/utils/functional.py", line > 276, in __getattr__ > [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] > self._setup() > [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] File "/usr/ > local/lib/python2.6/dist-packages/django/conf/__init__.py", line 40, > in _setup > [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] > self._wrapped = Settings(settings_module) > [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] File "/usr/ > local/lib/python2.6/dist-packages/django/conf/__init__.py", line 75, > in __init__ > [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] raise > ImportError("Could not import settings '%s' (Is it on sys.path? Does > it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)) > [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] ImportError: > Could not import settings 'iStore.settings' (Is it on sys.path? Does > it have syntax errors?): No module named iStore.settings > > Sorry to bother you, but i am very confused with this. > > On 4月6日, 上午3时28分, anvydigital <anvydigi...@gmail.com> wrote: > > > > > > > > > try changing: > > > os.environ['DJANGO_SETTINGS_MODULE']='www.iStore.settings' > > > to: > > > os.environ['DJANGO_SETTINGS_MODULE']='iStore.settings' > > > Since 'www' folder is on your path. > > > GL -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.