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 6680271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:27:20+00:00 2026-05-26T04:27:20+00:00

I have created two python environments with virtualenv: /usr/local/pythonenv/BASELINE and /usr/local/pythonenv/django1 . Both were

  • 0

I have created two python environments with virtualenv:
/usr/local/pythonenv/BASELINE and /usr/local/pythonenv/django1. Both were created with –no-site-packages.
I installed django to the django1 environment with easy_install.

My wsgi.conf file has this line to set the Python interpreter:

WSGIPythonHome /usr/local/pythonenv/BASELINE

My django.wsgi file starts like:

import site
site.addsitedir('/usr/local/pythonenv/django1/lib/python2.7/site-packages')
import os
import sys

But when I try to visit my site, I get a 500 Error, and httpd/error_log contains:

[error] Traceback (most recent call last):
[error]   File "/service/usr/local/django_apps/apache/django.wsgi", line 1, in ?
[error]     import site
[error] ImportError: No module named site

I am lost as to why the Python interpreter can’t import its own standard library. I’m not even sure how to check if httpd is even using the interpreter in /usr/local/pythonenv/BASELINE, so that would be a good start.

Edit: Unrelated but I was quite torn on whether I should post this here or to ServerFault. Advice on that front appreciated.

Edit: So I was able to get some debug information thanks to http://code.google.com/p/modwsgi/wiki/DebuggingTechniques. I changed my django.wsgi script to contain

import sys
def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World!'
    print >> environ['wsgi.errors'], sys.path
    print >> environ['wsgi.errors'], sys.prefix
    print >> environ['wsgi.errors'], sys.executable

    response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))]
    start_response(status, response_headers)
    return [output]

This put the Python interpreter information in /var/log/httpd/error_log. The error output:

[error] ['/usr/local/pythonenv/BASELINE/lib64/python24.zip',     '/usr/local/pythonenv/BASELINE/lib64/python2.4/', '/usr/local/pythonenv/BASELINE/lib64/python2.4/plat-linux2', '/usr/local/pythonenv/BASELINE/lib64/python2.4/lib-tk', '/usr/local/pythonenv/BASELINE/lib64/python2.4/lib-dynload']
[error] /usr/local/pythonenv/BASELINE
[error] /usr/bin/python

So sys.path and sys.executable point to my problem. For some reason sys.path is using some lib files that do not exist (BASELINE does not even contain a lib64 directory, and it was created with Python2.7), and sys.executable shows that mod_wsgi is still running the default /usr/bin/python interpreter, not the interpreter in /usr/local/pythonenv/BASELINE/bin.

Not sure why this is the case, but at least I know a bit more now.

EDIT: This is solved, but Django still lists “Python Executable: /usr/bin/python” even though it should be (and as far as I can tell, it is, since Python Version: 2.7.2) using /usr/local/bin/python. Is this normal?

  • 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-05-26T04:27:20+00:00Added an answer on May 26, 2026 at 4:27 am

    Your mod_wsgi is likely not compiled against Python 2.7. You cannot use a virtualenv for one Python version with mod_wsgi compiled against a different Python version.

    Read from:

    http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Shared_Library

    and do checks in that document.

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

Sidebar

Related Questions

Well as I have posted earlier too...I have created a site in two languages.One
I've created two wave files using Audacity. Both have 44100hz sample rate, 32-bit float
I am new to django. I have version 1.3.1 installed. I have created two
I have created two forms in my Windows Application. One Form acts as a
I have created two files: tunables.h #ifndef TUNABLES_H #define TUNABLES_H void tunables_load_conservative(); void tunables_load_aggressive();
I have created two JavaScript files. One file is "validators.js" and the other is
Let's say I have created two objects from class foo and now want to
I'm having a problem with mixing managed and unmanaged code. I have created two
I have created an item swapper control consisting in two listboxes and some buttons
I have created an alert view with two buttons using the following code: UIAlertView

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.