Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8785047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:15:12+00:00 2026-06-13T21:15:12+00:00

We are trying to get out wsgi application working on mod_wsgi. We have run

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:15:13+00:00Added an answer on June 13, 2026 at 9:15 pm

    Is rest.py under /var/www/python or /var/www/python/resource? Adding this directory to sys.path should work as far as I know. Preferable to using a string constant would be the following:

    sys.path.append(os.path.dirname(__file__))
    

    This should work even if you decide to deploy to a different location in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get out of browser support working for my Silverlight application
We are trying to get quaqua out of our application. We had been using
I have a json file that I'm trying to get values out of. One
I have been trying to track down weird problems with my mod_wsgi/Python web application.
I have some Objective-C++ code that I'm trying to get events out of an
I have a rather simple question. I'm trying to get information out of an
I'm trying to get data out of an array by using following command: $newarray
I'm trying to get started with Scala and cannot get out of the starting
I am trying to get put out a simple site, which would pool the
I am currently trying to get data out of a plist. It basically looks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.