How does Django + mod_wsgi affect the python path?
I have a simple setup with my python libraries in /domains/somedomain.com/libs/ and all my tests run fine. I start WSGI with DJANGO_SETTINGS_MODULE to "somedomain.settings" where somedomain is a package in libs/
Suddenly, when adding pywapi.py into libs/ I can't im开发者_C百科port it when hitting the site. But, if I add 'import pywapi' to my wsgi script, it fails when hit by Apache, but succeeds if I just write it. the WSGI itself is actually adding libs/ to the path, so I know it should be there when running. The path is absolute, too, so any change in CWD shouldn't be causing this.
I can't think of anything else and I've been tinkering with it half of my otherwise productive morning.
I think the problem is related with the permissions of that file. Check that the user running wsgi (apache user, usually) is capable of reading and writing the everything in the libs folder and specially capable of reading the file pywapi.py.
精彩评论