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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:54:34+00:00 2026-05-13T15:54:34+00:00

The issue I’m having is my wsgi file can’t import the wsgi handlers properly.

  • 0

The issue I’m having is my wsgi file can’t import the wsgi handlers properly.

/var/log/apache2/error.log reports:

ImportError: No module named
django.core.handlers.wsgi

Googling this brings up a couple results, mostly dealing with permissions errors because www-data can’t read certain files and/or the pythonpath is not correct. Some of the solutions are vague or just don’t work in my circumstance.

Background information..

My /usr/lib directory..

/usr/lib/python2.4
/usr/lib/python2.5
/usr/lib/python2.6
/usr/lib/python-django

The default python version is 2.5.2. If I open the interpreter as a regular user I can import django.core.handlers.wsgi with no issues.

If I switch to www-data the python version is the same, and I can import the django.core.handlers.wsgi module no problem.

In my bashrc, I set my PYTHONPATH to my home directory which contains all my django sites…

export PYTHONPATH=/home/meder/django-sites/:$PYTHONPATH

So the directory structure is:

django-sites/
   test

test is the directory created by django-admin createproject.

My virtualhost:

<VirtualHost *:80>
    ServerName beta.blah.com
    WSGIScriptAlias / /home/meder/django-sites/test/apache/django.wsgi
    Alias /media /home/meder/django-sites/test/media/
</VirtualHost>

The /home/meder/django-sites/test/apache/django.wsgi file itself:

import os, sys

sys.path.append('/usr/local/django')
sys.path.append('/home/meder/django-sites')
sys.path.append('/home/meder/django-sites/test')
os.environ['DJANGO_SETTINGS_MODULE'] = 'test.settings'

import django.core.handlers.wsgi

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

Finally, my OS is Debian Lenny and I grabbed django 1.1.1 from backports. Hope that’s enough information.

Update #1 – per the first reply here’s the result of ldd /usr/lib/apache2/modules/mod_wsgi.so:

meder@site:/usr/lib/apache2/modules$ ldd mod_wsgi.so
    libpython2.5.so.1.0 => /usr/lib/libpython2.5.so.1.0 (0xb7d99000)
    libpthread.so.0 => /lib/libpthread.so.0 (0xb7d81000)
    libdl.so.2 => /lib/libdl.so.2 (0xb7d7c000)
    libutil.so.1 => /lib/libutil.so.1 (0xb7d78000)
    libm.so.6 => /lib/libm.so.6 (0xb7d52000)
    libc.so.6 => /lib/libc.so.6 (0xb7c14000)
    /lib/ld-linux.so.2 (0xb7efd000)

So it is compiled against python 2.5 and not 2.4.

  • 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-13T15:54:34+00:00Added an answer on May 13, 2026 at 3:54 pm

    Since I’m on Debian it appears that django is in /usr/lib/pymodules/python2.5 and not /usr/lib/python2.5/site-packages.

    I added

    sys.path.append('/usr/lib/pymodules/python2.5') 
    

    to the top of my wsgi file and that did it, although I feel as though I should be fixing this in a more proper manner.

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

Sidebar

Related Questions

issue facing while loading the messages in to mq channel, recieving an error like
Issue Using the following just simply doesn't work properly in -webkit- and -moz- browsers:
Issue: Child model collection in MVC3 & Entity Framework 4.1 is being updated properly
Issue I'm having is returning some data in a sidebar depending on which category
Main issue is that I'm developing an app for Android and iOS but can't
Issue 2. I am now getting an error in where the code is not
issue is this: in (pl)python code, we've calculated an integer = 26663. Can easily
Issue I am having difficulty debugging inside of my application's timerEvent functions. While the
Issue is that I can't change a column type to 'Text' This is the
ISSUE (LogCat) sqlite returned: error code = 1, msg = no such table ...

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.