1
votes

In a harrowing attempt to get mod_wsgi to run on CentOS 5.4, I've added Python 2.6 as an optional library following the instructions here. The configuration seems fine except that when trying to ping the server the Apache log prints this error:

mod_wsgi (pid=20033, process='otalo', application='127.0.0.1|'): Loading WSGI script '...django.wsgi'. 
[Sat Mar 27 16:11:45 2010] [error] [client 171.66.52.218] mod_wsgi (pid=20033): Target WSGI script '...django.wsgi' cannot be loaded as Python module. 
[Sat Mar 27 16:11:45 2010] [error] [client 171.66.52.218] mod_wsgi (pid=20033): Exception occurred processing WSGI script '...django.wsgi'. 
[Sat Mar 27 16:11:45 2010] [error] [client 171.66.52.218] Traceback (most recent call last): 
[Sat Mar 27 16:11:45 2010] [error] [client 171.66.52.218]   File "...django.wsgi", line 8, in <module> 
[Sat Mar 27 16:11:45 2010] [error] [client 171.66.52.218]     import django.core.handlers.wsgi 
[Sat Mar 27 16:11:45 2010] [error] [client 171.66.52.218] ImportError: No module named django.core.handlers.wsgi

when I go to my python2.6 install's command line and try 'import Django', the module is not found (ImportError). However, my default Python 2.4 installation (still working fine) is able to import successfully. How do I point Python 2.6 to Django?

2

2 Answers

0
votes

You need to install Django specifically with/for the Python version that's meant to use it -- installs for 2.4 and 2.6 are always going to be separate (they have to be -- there are incompatibilities in binary and bytecode formats!). I don't know what, if any, possibilities CentOS offers for that -- I'd get Django's sources and install from sources (which boils down to: download, tar, cd, and finally a simple sudo python2.6 setup.py install -- or however else you run your 2.6 install of Python). Being a much better developer than I'm a system administrator, I always have a bias in favor of installing from sources for stuff that's really at the core of what I'm doing (especially Python versions and extensions).

0
votes

I created a write up link text of my experiences of getting Django working on Redhat and and CentOS. I upgraded the version of python that I was using and started with init.d scripts.