PYTHONPATH of a user account is not inherited by the Apache process as it runs from root account initially.
As such,if your ability to find installed Django is dependent on PYTHONPATH setting in your user environment, you must duplicate that in WSGI script file. For example: import sys sys.path.insert(0, '/u/chiwilli/django/lib/python') This must come before Django is imported by the WSGI script file. Graham 2009/12/8 [email protected] <[email protected]>: > Hi, > > I made this change and seemed to get a bit further, but I am still > having issues. > > Now the errors in my apache log are as follows: > > mod_wsgi (pid=4001): Target WSGI script '/u/chiwilli/apache/wsgi- > scripts/django.wsgi' cannot be loaded as Python module. > mod_wsgi (pid=4001): Exception occurred processing WSGI script '/u/ > chiwilli/apache/wsgi-scripts/django.wsgi'. > Traceback (most recent call last): > File "/u/chiwilli/apache/wsgi-scripts/django.wsgi", line 10, in ? > import django.core.handlers.wsgi > ImportError: No module named django.core.handlers.wsgi > > I don't own the installation of Python. I do know that I have version > 2.6.4 > > python -V > Python 2.6.4 > > Any thoughts? > > Thank you, > China > > On Dec 6, 4:56 pm, Graham Dumpleton <[email protected]> > wrote: >> 2009/12/7 [email protected] <[email protected]>: >> >> > Hi, >> >> > Thank you for your response. >> >> > In the first instance of my post the WSGIScriptAlias does not have the >> > trailing / and that is when it is not working. >> >> Yes it does? >> >> My bad wording though. Second argument on the line, so first argument >> to WSGIScriptAlias. >> >> Just try what I said to use: >> >> WSGIScriptAlias /wsgi-scripts /u/chiwilli/apache/wsgi-scripts/django.wsgi >> >> Note how it says '/wsgi-scripts' and NOT '/wsgi-scripts/'. >> >> Without trailing slash is what documentation on mod_wsgi site always >> says when final argument is a WSGI script file. >> >> Trailing slashes should only be used when final argument is a directory. >> >> Graham >> >> > Thank you, >> > China >> >> > On Dec 6, 4:32 pm, Graham Dumpleton <[email protected]> >> > wrote: >> >> 2009/12/7 [email protected] <[email protected]>: >> >> >> > Hello, >> >> >> > I am new to Django and I am trying to get through the djangoproject >> >> > tutorial. >> >> >> > Here is my configuration: Apache 2.2.2, Django 1.1 >> >> >> > httpd.conf: >> >> > LoadModule wsgi_module modules/mod_wsgi.so >> >> >> > <Directory /u/chiwilli/apache/wsgi-scripts> >> >> > Order allow,deny >> >> > Allow from all >> >> > </Directory> >> >> >> > WSGIScriptAlias /wsgi-scripts/ /u/chiwilli/apache/wsgi-scripts/ >> >> > django.wsgi >> >> >> The instructions DO NOT say to have a trailing slash on second >> >> argument where third argument is a WSGI script file. Remove it so you >> >> have: >> >> >> WSGIScriptAlias /wsgi-scripts >> >> /u/chiwilli/apache/wsgi-scripts/django.wsgi >> >> >> Also read: >> >> >> http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines >> >> >> where is says when and when not to have a trailing slash. >> >> >> Graham >> >> >> > <VirtualHost *:80> >> >> > ServerName silo.cs.indiana.edu >> >> > ServerAdmin [email protected] >> >> > DocumentRoot /u/chiwilli/apache/wsgi-scripts >> >> > </VirtualHost> >> >> >> > .bachrc: >> >> >> > PYTHONPATH=/u/chiwilli/django/lib/python >> >> > export PYTHONPATH >> >> >> > django is at: >> >> > /u/chiwilli/Django-1.1.1/django >> >> >> > /u/chiwilli/apache/wsgi-scripts/django.wsgi: >> >> > import os >> >> > import sys >> >> >> > sys.path.append('/u/chiwilli/Django-1.1.1/django') >> >> >> > os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' >> >> >> > import django.core.handlers.wsgi >> >> > application = django.core.handlers.wsgi.WSGIHandler() >> >> >> > When I try to access: >> >> >http://silo.cs.indiana.edu:8344/wsgi-scripts/mysite/admin/ >> >> >> > I get the following: >> >> > Target WSGI script not found or unable to stat: /u/chiwilli/apache/ >> >> > wsgi-scripts/django.wsgimysite >> >> > in my apache/logs/error_log >> >> >> > I think I am close because when I change WSGIScriptAlias to: >> >> >> > WSGIScriptAlias /wsgi-scripts/ /u/chiwilli/apache/wsgi-scripts/ >> >> >> > I can see a little test "hello world" page. >> >> >> > Any ideas? >> >> >> > Thank you. >> >> >> > -- >> >> >> > 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 >> >> > athttp://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 >> > athttp://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. > > > -- 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.
