Provide the output of running: ls -las /home/djangodeploy ls -las /home/djangodeploy/*/settings.py
Graham On 31 March 2011 07:08, Fred <[email protected]> wrote: > I've been googling and trying this for 2 days now, I'm sure I'm just > confused about something basic because it cannot be that hard. I've > tried all the hints I found via google and they made sense but no > success. I've read Graham D's excellent wiki on configuring wsgi to > work with django, but I'm still stuck. > > I'm running RHEL 6 Python 2.6.5, django 1.2.4 and mod_wsgi 3.2. So my > directory structure looks like this: > /var/www/wsgi-scripts > -> myapp.wsgi > -> test2.wsgi > ... such that I can drop in any wsgi file to deploy a new app. > > I plan to deploy my django sites (totally independent of one another, > but all related to our intranet). I'm trying to configure the server > so I can deploy independent django sites via wsgi. I'll be content if > I can just get one app to work, so this multi-app thing is just > planning for the future. My directory is as follows > /home/djangodeploy # also tried as /var/www/djangodeploy > -> __init__.py > -> mysite1 > -> mysite2 > ________________________________________________________________ > I got a basic myapp.wsgi working OK and it prints out sys.path as > follows: > /home/djangodeploy > /usr/lib/python26.zip > /usr/lib/python2.6 > /usr/lib/python2.6/plat-linux2 > ...snip... > /usr/lib/python2.6/site-packages/webkit-1.0 > ________________________________________________________________ > I've made sure apache is the user for all files and even changed > permissions to 777. I've remembered to restart apache each time. I > tried to import settings.py from the command line to make sure there > were no syntax errors and it works. This site worked under the debug > server also. > ________________________________________________________________ > My wsgi.conf file looks like this (I also had the daemon version > working, but removed it until I can get past this problem): > > LoadModule wsgi_module modules/mod_wsgi.so > WSGIScriptAlias /wsgi /var/www/wsgi-scripts > WSGIPythonPath /home/djangodeploy > LogLevel info > WSGISocketPrefix /var/run/wsgi > > <Directory /var/www/wsgi-scripts> > Order allow,deny > Allow from all > </Directory> > > <Directory /home/djangodeploy> ### I'm not sure about this last > Directory, grasping at straws. > Order allow,deny > Allow from all > </Directory> > > ________________________________________________________ > My wsgi module to launch django looks like this > > import os, sys > print >>sys.stderr, __file__, sys.path > #import homeworks # this did not work > > > os.environ['DJANGO_SETTINGS_MODULE'] = 'homeworks.settings' #this did > not work #never gets here import django.core.handlers.wsgi application > = django.core.handlers.wsgi.WSGIHandler() > ______________________________________________ > > And the output of the apache error log looks like this (timestamp and > ip deleted for brevity): > > ImportError: Could not import settings 'homeworks.settings' (Is it on > sys.path? Does it have syntax errors?): No module named > homeworks.settings > > /var/www/wsgi-scripts/test2.wsgi ['/home/djangodeploy', '/usr/lib/ > python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', > '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/ > python2.6/lib-dynload', '/usr/lib/python2.6/site-packages', '/usr/lib/ > python2.6/site-packages/gst-0.10', '/usr/lib/python2.6/site-packages/ > gtk-2.0', '/usr/lib/python2.6/site-packages/webkit-1.0'] > > mod_wsgi (pid=2399): Exception occurred processing WSGI script '/var/ > www/wsgi-scripts/test2.wsgi'. > Traceback (most recent call last): > File "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", > line 230, in __call__ > self.load_middleware() > File "/usr/lib/python2.6/site-packages/django/core/handlers/ > base.py", line 33, in load_middleware > for middleware_path in settings.MIDDLEWARE_CLASSES: > File "/usr/lib/python2.6/site-packages/django/utils/functional.py", > line 276, in __getattr__ > self._setup() > File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", > line 40, in _setup > self._wrapped = Settings(settings_module) > File "/usr/lib/python2.6/site-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)) [Wed Mar 30 11:46:53 2011] [error] [client 192.168.218.34] > ImportError: Could not import settings 'homeworks.settings' (Is it on > sys.path? Does it have syntax errors?): No module named > homeworks.settings > > > Would someone be kind enough to show me my mistake. I've tried all I > can think of. > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
