Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have trouble with configuring a Django server in mode wsgi with Ubuntu 11.10. Here is the problem: the latest ubuntu 11.10 has python2.7 as default. Installing apache2 and libapache2-mod-wsgi expect to work with python2.6. My configuration is tested before and works, but not in these circumstances. Now I have 403 Forbidden message. What would you recommend me. Keep python2.7 and compile apache wsgi for python2.7 or make python2.6 default to the system (wich is bad, as 2.7 is better for my django requirements)

share|improve this question

migrated from stackoverflow.com Nov 21 '11 at 3:37

This question came from our site for professional and enthusiast programmers.

    
Instead of troubleshooting the Python version (which is not an issue at all, it requires both 2.6 and 2.7, see here), how about providing your Apache config and the contents of Apache's error log? –  Shane Madden Nov 21 '11 at 5:29
add comment

3 Answers 3

up vote 0 down vote accepted

How about to use a virtual environment through mkvirtualenv command? You can choose your own version of Python for your virtual environment. Actually, Ubuntu allows you to install Python 2.6 and 2.7 from the binaries packages.

$ mkvirtualenv name --python=python2.7 --no-site-packages
share|improve this answer
    
As you said, libapache2-mod-wsgi works fine with both python 2.6 and 2.7. My fault linked with the folder permissions. Anyway, virtualenv is a must! Meanwhile I'll check uWSGI. Thank you for your answer! –  Method Nov 21 '11 at 11:45
add comment

If Python 2.7 is better for your requirements I suggest you to compile mod_wsgi for that version of Python.

In theory, libapache2-mod-wsgi should work properly with Python 2.6:

Depends: apache2, apache2.2-common, libc6 (>= 2.4), libpython2.6 (>= 2.6),   
libpython2.7 (>= 2.7), python (>= 2.6), python (<< 2.8)

Another option is to use uWSGI (libapache2-mod-uwsgi) for Apache.

share|improve this answer
    
I made it work, thanks for your answer! –  Method Nov 21 '11 at 11:31
add comment

I was just trying to find out how to setup mod_wsgi with Python 2.7 on my Ubuntu 11.10 server when I discovered that libapache2-mod-wsgi comes with binaries for both Python 2.6 and 2.7.

You can select between 2.6 and 2.7 by changing a symbolic link.

root@webserver-01:/etc/apache2/mods-available# ls /usr/lib/apache2/modules/mod_wsgi* -la
lrwxrwxrwx 1 root root     15 2011-06-03 15:01 /usr/lib/apache2/modules/mod_wsgi.so -> mod_wsgi.so-2.7
-rw-r--r-- 1 root root 152064 2011-06-03 15:01 /usr/lib/apache2/modules/mod_wsgi.so-2.6
-rw-r--r-- 1 root root 152064 2011-06-03 15:01 /usr/lib/apache2/modules/mod_wsgi.so-2.7
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.