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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:09:47+00:00 2026-05-13T17:09:47+00:00

So I am trying to make Django running with mod-wsgi for the first time.

  • 0

So I am trying to make Django running with mod-wsgi for the first time. I have configured Apache as shown in examples and I am pretty sure I did everything right.

I did not set the PYTHON_EGG_CACHE variable so it uses the default: /var/www/.python-eggs. I have created this directory and made it writeable for user www-data.

When I open the site it shows the output from 500.html template and here’s what I get in log:

   ...
   File "/usr/local/.../parts/django/django/db/__init__.py", line 17, in load_backend
     return import_module('.base', 'django.db.backends.%s' % backend_name)
   File "/usr/local/.../parts/django/django/utils/importlib.py", line 35, in import_module
     __import__(name)
   File "/usr/local/.../parts/django/django/db/backends/postgresql_psycopg2/base.py", line 22, in <module>
     raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
 ImproperlyConfigured: Error loading psycopg2 module: cannot import name tz

Here’s what I have in /var/www/.python-eggs/

# ls -la /var/www/.python-eggs/
total 12
drwxr-xr-x 3 www-data www-data 4096 Jan 27 04:19 .
drwxr-xr-x 5 root     root     4096 Jan 27 04:18 ..
drwxr-xr-x 3 www-data www-data 4096 Jan 27 04:19 psycopg2-2.0.13-py2.5-linux-i686.egg-tmp

# ls -la /var/www/.python-eggs/psycopg2-2.0.13-py2.5-linux-i686.egg-tmp/psycopg2/
total 368
drwxr-xr-x 2 www-data www-data   4096 Jan 27 04:19 .
drwxr-xr-x 3 www-data www-data   4096 Jan 27 04:19 ..
-rwxr-xr-x 1 www-data www-data 363318 Jan 22 03:44 _psycopg.so

The only file in psycopg2 egg directory is _psycopg.so. There’s no tz.py file and I think this is the problem.

Please advice.

P.S., I use buildout and djangorecipe to deploy Django. I run buildout script with buildout user. Not sure if it makes sense though.

P.P.S, psycopg2 is installed correctly because I am able to run syncdb.

  • 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-13T17:09:47+00:00Added an answer on May 13, 2026 at 5:09 pm

    Ok, I have found the solution. I have used the system python for buildout and it already had psycopg2 in site-packages. It seems there was some kind of conflict between psycopg2 in system site-packages and the one installed by buildout. I have set up a virtual python environment and used it for buildout. And this helped! No more import errors.

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

Sidebar

Related Questions

I have been trying to integrate Google calendar into a Django application running on
I'm running an Apache server (v2.2.10) with mod_python, Python 2.5 and Django. I have
I'm trying to make a signup form via html/django so I have 3 input
I'm trying to make a custom view in Django admin. I'm reading from this
I'm trying to solve the relational model in order to make a Django app.
'm trying to make a small modification to django lfs project, that will allow
Im new to django and trying to make a user registration form with few
I'm trying to make an array out of a text file My django/python code
I am trying to make an chat application using python and django. I almost
I' m trying to build a Django TemplateLoader, but I can't make it 'see'

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.