Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We are trying to get out wsgi application working on mod_wsgi. We have run it before using wsgiref.simple_server, as a debugging environment. Now, we want to move it over to using Apache httpd to integrate with loading static files under the same port, and to provide an environment more suitable for production.

The httpd.conf file we have set up looks like this:

<VirtualHost *:80>

    DocumentRoot /var/www/

    ErrorLog /var/www/log/error_log

    LogLevel debug

    WSGIScriptAlias /app /var/www/python/resource/

    <Directory /var/www/python/>
            Order allow,deny
            Allow from all

    <Directory />
            Order allow,deny
            Allow from all

            RewriteEngine On
            # Some rewrites go here



With this setup, we can access the main application file, (under http://myhost/app), but any imports to modules (like from module1 import function where module1 is under the same directory as are failing with an ImportError.

I suspect this has to do with having to set some sort of environment variable, but I have added /var/www/python to sys.path on the main application method and it doesn't work. Any help or pointers with this would be really appreciated.


share|improve this question

closed as off-topic by Jenny D, Michael Hampton Feb 28 '14 at 22:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Michael Hampton
If this question can be reworded to fit the rules in the help center, please edit the question.

In which directory is 'module1' located? Do all the code files have permissions such that user that Apache runs as can read them? – Graham Dumpleton Nov 6 '12 at 1:29
Module 1 is located under the same directory as Yes, I actually set the permissions to 777 to avoid any problem like that. – Juan Carlos Coto Nov 6 '12 at 15:11