My goal is to set up Python 3 with Apache. My biggest problem is actually acquiring mod_python.so. For the life of me I found only one site where it could be downloaded (http://
These answers are no longer true of Django 1.6 - it supports python3. The mod_wsgi page says version 3.4 supports python 3. https://code.google.com/p/modwsgi/
Don't know if it all works at this point though (I will return and edit when I find out)!
The answer is YES it works!
I have an AWS EC3 Ubuntu instance running Python3, Django 1.5.6, Apache2.2 and mod_wsgi 3.4
Python 3.3.4:
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get install python3.3
sudo apt-get install python3.3-dev python3.3-doc idle-python3.3
ppa:fkrull/deadsnakes is a apt repo has has multiple python versions available - see https://launchpad.net/~fkrull/+archive/deadsnakes
Then I added pip using the instructions at the pip page; http://pip.readthedocs.org/en/latest/installing.html. (remember your python is probably on your path as 'python3.3' at this point, plain 'python' will point at python 2.x!)
After that, virtualenv. Then I virtualenv'd the python installation. Upon activation and adding the environment's bin/ directory to the $PATH I've now got a clean python3.
Then, after I activated the virtual env, I did 'pip Django' and all my other necessary packages (which were quite a few). I have Django version 1.6.2 (I've been developing on this and running under python 3.3.3 on my Mac no problem).
The most trouble I had was installing lxml because it requires libxml2 and libxslt to be installed with apt-get (it is a wrapper around the C code) and it took me a couple of attempts to realise that they were not already installed (lxml compilation fails).
After tossing about getting my RDS database instance up and running and available (postgresql, beware mysql under python3, you'll get plenty of python db driver pain! but most of my issues were caused by me trying to understand the AWS security configuration), it was relatively plain sailing:
sudo apt-get install apache2 apache2-threaded-dev
That installs apache - and you need the dev packages for the next bit.
And that point, I tried using the apt package for mod_wsgi but I decided that the best thing to do was to compile and install it myself, following the instructions here - https://code.google.com/p/modwsgi/wiki/InstallationInstructions
I had no problems with configure, make, or make install. Make sure you compile it in your virtualenv activated environment.
You have to manually add the configuration to Apache's configuration:
# wsgi module
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
# now configure it
Order deny,allow
Allow from all
WSGIScriptAlias / /my/app/path/wsgi.py
WSGIPythonPath /my/app:/path/to/the/virtual/env/lib/python3.3/site-packages
And in the broadest possible way, this is all now working.