2

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/rest.py

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

    <Directory />
            Order allow,deny
            Allow from all

            RewriteEngine On
            # Some rewrites go here

    </Directory>

</VirtualHost>

With this setup, we can access the main application file, rest.py (under http://myhost/app), but any imports to modules (like from module1 import function where module1 is under the same directory as rest.py) 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.

Thanks!

Juan Carlos Coto
  • 677
  • 2
  • 6
  • 13

0 Answers0