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

  • SEARCH
  • Home
  • 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 8204349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:52:20+00:00 2026-06-07T07:52:20+00:00

pythonbrew isn’t getting picked up by by mod_wsgi file, config follows: import os import

  • 0

pythonbrew isn’t getting picked up by by mod_wsgi file, config follows:

import os
import sys
import site

site.addsitedir('/home/bharal/.pythonbrew/pythons/Python-2.7.2/lib/python2.7/site-packages')
sys.path.append ('/home/bharal/public_html/dumpstown')

os.environ['DJANGO_SETTINGS_MODULE'] = 'dumpstown.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

and the pythonbrew version of python i want to use is situated here:

/home/bharal/.pythonbrew/pythons/Python-2.7.2/lib/python2.7/site-packages

and my pythonbrew install is here:

/home/bharal/.pythonbrew/

How do i tell mod_wsgi to use this version (2.7.2) and not the default python version that shipped with ubuntu (2.6)?

When i run my server, i get errors like so:

[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1] mod_wsgi (pid=18694): Exception occurred processing WSGI script '/home/bharal/public_html/dumpstown/dumpstown/apache/dumpstown.wsgi'.
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1] Traceback (most recent call last):
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]   File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 250, in __call__
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]     self.load_middleware()
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]   File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 39, in load_middleware
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]     for middleware_path in settings.MIDDLEWARE_CLASSES:
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]   File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py", line 276, in __getattr__
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]     self._setup()
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]   File "/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py", line 42, in _setup
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]     self._wrapped = Settings(settings_module)
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]   File "/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py", line 89, in __init__
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]     raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1] ImportError: Could not import settings 'dumpstown.settings' (Is it on sys.path?): No module named gravatar.templatetags

as you can see from the logs, the server is still looking at python 2.6!! Why? I’ve kicked off pythonbrew so when i type in python i can see the version is 2.7.2, and all the settings and packages i need are importable!

UPDATE as indicated in the answer below, the mod_wsgi doesn’t care which python i tell it to use – in fact, i cannot tell it to use any particular python. The only way to do so is to download an uncompiled wsgi file, compile with the particular python version i want, and use the compiled wsgi.

See my other question Error: Command failed with rc=65536 python and mod_wsgi for some of the steps and links to tutes if you like. In the end i didn’t compile against 2.7 (my 2.6 was fine and it was too hard to get the pythonbrew compile working)

  • 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-07T07:52:22+00:00Added an answer on June 7, 2026 at 7:52 am

    That particular error has nothing to do with the version of Python used. Use:

    sys.path.append (‘/home/bharal/public_html’)
    sys.path.append (‘/home/bharal/public_html/dumpstown’)

    To get mod_wsgi to use a specific version, compile it from source code against that version or find a binary package for mod_wsgi compiled against the correct version.

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

Sidebar

Related Questions

I'm trying to deactivate pythonbrew from a bash script. When inside the shell typing
I installed pythonbrew, but when I try to install python, I get an error:
I'm using pythonbrew to install Python 2.6.6 on Snow Leopard. It failed with a
i'm having this problem: i'm runing pythonbrew to get python2.7, and so i re-compiled
I've started using npm for JavaScript package management recently. Although I do have a
I'm just moving over from Ruby/Rails development to Python/Django and i'm trying to find
What's going on? I tried iPython and the regular Python interpreter, both show ^[[A
First, please bear with me. I have hard time telling others my problem and
I have another thread asking help on missing zlib. With the nice help the
I am new to python and I am planning to learn django. I had

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.