I dont usually deal with Apache+WSGI (usually fcgi + nginx)
However your script:
WSGIScriptAlias /wsgi /var/www/wsgi-scripts
One of my apache sites:
WSGIScriptAlias / /home/hvv00/hvv/wsgi/hvv.wsgi
Point directly this directly to the file.
Note: You wont need to chmod 777 anything
<VirtualHost 203.132.11.10:80>
ServerName ....
ServerAlias ....
ServerAdmin mr.samuel@gmail.com
UseCanonicalName Off
<Directory /home/hvv00/hvv/wsgi>
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / /home/hvv00/hvv/wsgi/hvv.wsgi
CustomLog /usr/local/apache/domlogs/hvv.com.au combined
BytesLog /usr/local/apache/domlogs/hvv.com.au-bytes_log
</VirtualHost>
Hope that helps.
cheers
sam_W
On Thu, Mar 31, 2011 at 3:02 AM, Sells, Fred
<fred.sells@adventistcare.org> 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'm running RHEL 6 Python 2.6.5, django 1.2.4 and mod_wsgi 3.2. I'm
> trying to configure the server so I can deploy independent django sites
> via wsgi. 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) as follows
> /home/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:
>
> 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 "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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment