-2

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)

Bart De Vos
  • 17,761
  • 6
  • 62
  • 81
Method
  • 101
  • 2
  • Instead of troubleshooting the Python version (which is not an issue at all, it requires both 2.6 and 2.7, see [here](http://packages.ubuntu.com/oneiric/libapache2-mod-wsgi)), how about providing your Apache config and the contents of Apache's error log? – Shane Madden Nov 21 '11 at 05:29

3 Answers3

1

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.

0

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
  • 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
0

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
Shaun Kruger
  • 111
  • 3