Specifically, you cant use SetEnv to set PYTHON_PATH in Apache
configuration. Go watch mod_wsgi presentation listed at
http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6

Also go read Django documentation page on mod_wsgi site, as well as
that on virtual environments which explains more about setting module
search path.

Graham

On Monday, September 27, 2010, Carl Nobile <[email protected]> wrote:
> To use
>
> os.environ['DJANGO_SETTINGS_MODULE'] = path.settings
>
> in the wsgi file you must import os there also.
>
> What is www-user?
>
> You need to put the path to any code that will be executed in your app
> in the sys.path list in your wsgi file or nothing will work correctly.
> This included the path to django, and any site-packages that are
> outside the python install.
>
> ~Carl
>
> On Mon, Sep 27, 2010 at 12:17 PM, safar objorn <[email protected]> wrote:
>> On Mon, Sep 27, 2010 at 9:31 AM, Carl Nobile <[email protected]> wrote:
>>>
>>> The error you mentioned above is caused by one of two reasons.
>>>
>>> 1) The settings.py path was never defined in your wsgi file.
>>> 2) the settings.py file itself is broken and cannot be loaded even if
>>> the path to it is correct.
>>>
>>> The first is easy to fix just add something like this to your wsgi file:
>>>
>>> import os
>>>
>>> os.environ['DJANGO_SETTINGS_MODULE'] = path.settings
>>
>> I do have os imported in the settings.py and as mentioned,
>> DJANGO_SETTINGS_MODULE has been specified in the django.wsgo file:
>>
>> os.environ['DJANGO_SETTINGS_MODULE'] = 'blog.settings'
>>
>> blog is the name of my django project.
>>
>>
>>> The second problem can be debuged by trying to load the settings file
>>> in the python interpreter manually and track the error from there.
>>
>> I just executed python -v settings.py and no error was presented. My
>> PYTHON_PATH is just fine though, I'm concerned about the www-user
>> though. I don't know how to specify the sys.path for it, but I was
>> thinking mod_wsgi should take care of this.
>>
>>> ~Carl
>>>
>>> On Mon, Sep 27, 2010 at 9:18 AM, safar objorn <[email protected]> 
>>> wrote:
>>> > I know this isn't safe, but I haven't setup groups yet for the www-admin
>>> > user, I just gave everything in my /home/safar/sites/public/ directory 777
>>> > privileges. Also, /home/ehath/sites/public/blog/ should be
>>> > /home/safar/sites/public/blog/, but either way, it doesn't affect 
>>> > anything.
>>> >
>>> > On Mon, Sep 27, 2010 at 8:11 AM, safar objorn <[email protected]>
>>> > wrote:
>>> >>
>>> >> I've searched the logs from the mailing list, I went three pages deep
>>> >> before deciding to ask for help. It seems there are several other people 
>>> >> who
>>> >> have experienced this, and I don't want to think mine is any different, 
>>> >> but
>>> >> I'm not seeing the solution, and I'm hoping someone here can help me.
>>> >>
>>> >> This is the error when retrieving attempting to retrieve the page:
>>> >>
>>> >> "
>>> >> (500) Internal Server Error
>>> >>
>>> >> The server encountered an internal error or misconfiguration and was
>>> >> unable to complete your request.
>>> >>
>>> >> Please contact the server administrator, [no address given] and inform
>>> >> them of the time the error occurred, and anything you might have done 
>>> >> that
>>> >> may have caused the error.
>>> >>
>>> >> More information about this error may be available in the server error
>>> >> log.
>>> >> "
>>> >>
>>> >>
>>> >> This is the error given by /var/log/apache2/error.log:
>>> >>
>>> >> "
>>> >> [Mon Sep 27 07:54:23 2010] [error] [client 127.0.0.1]     raise
>>> >> ImportError, "Could not import settings '%s' (Is it on sys.path? Does it
>>> >> have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
>>> >> [Mon Sep 27 07:54:23 2010] [error] [client 127.0.0.1] ImportError: Could
>>> >> not import settings 'blog.settings' (Is it on sys.path? Does it have 
>>> >> syntax
>>> >> errors?): No module named blog.settings
>>> >> "
>>> >>
>>> >>
>>> >> This is the contents of my /home/safar/sites/public/blog/apache.py file:
>>> >>
>>> >> "
>>> >> import os, sys
>>> >>
>>> >> sys.path.append('/home/safar/sites/public')
>>> >> os.environ['DJANGO_SETTINGS_MODULE'] = 'blog.settings'
>>> >> import django.core.handlers.wsgi
>>> >> application = django.core.handlers.wsgi.WSGIHandler()
>>> --
> -------------------------------------------------------------------------------
> Carl J. Nobile (Software Engineer)
> [email protected]
> -------------------------------------------------------------------------------
>
> --
> 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.

Reply via email to