the path should be: path='/home/yongzhen/workspace/www'
for iStore.settings to resolve On Mar 31, 1:40 pm, yongzhen zhang <4...@live.cn> wrote: > Hi, > I am using apache + wsgi for my Django project. But now i am a bit > confused. The project is under /home/yongzhen/workspace/www . I put > the apache folder under www, and it is same level with the project > "iStore". i write django.wsgi inside apache like this: > import os > import sys > path='/home/yongzhen/workspace/www/iStore' > if path not in sys.path: > sys.path.append(path) > > 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']='www.iStore.settings' > > import django.core.handlers.wsgi > application=django.core.handlers.wsgi.WSGIHandler() > > But it does not work, the apache has the following error: > mod_wsgi (pid=11619): Exception occurred processing WSGI script '/ > home/yongzhen/workspace/www/apache/django.wsgi'. > Traceback (most recent call last): > File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/ > wsgi.py", line 230, in __call__ > self.load_middleware() > File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/ > base.py", line 33, in load_middleware > for middleware_path in settings.MIDDLEWARE_CLASSES: > File "/usr/local/lib/python2.6/dist-packages/django/utils/ > functional.py", line 276, in __getattr__ > self._setup() > File "/usr/local/lib/python2.6/dist-packages/django/conf/ > __init__.py", line 40, in _setup > self._wrapped = Settings(settings_module) > File "/usr/local/lib/python2.6/dist-packages/django/conf/ > __init__.py", line 75, in __init__ > raise ImportError("Could not import settings '%s' (Is it on > sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, > e)) > [error] [client 66.249.66.53] ImportError: Could not import settings > 'iStore.settings' (Is it on sys.path? Does it have syntax errors?): No > module named iStore.settings > > It seems that something wrong with > "os.environ['DJANGO_SETTINGS_MODULE']='www.iStore.settings'", but it > also does not work when i change it to > os.environ['DJANGO_SETTINGS_MODULE']='iStore.settings' > Anyone knows what is the problem? -- 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.