Ubuntu - mod_python Installation

Following from the django install article, we now look one way of serving our application. mod_python is a simple to use (and setup) tool for serving python based web applications from Apache. This article will walk you through installing and setting up mod_python with Apache.


Since we're focusing on Apache with mod_python, we'll need to have apache installed. You can follow this article specifically for detailed instructions or you can simply use the following command to install the necessary Apache components:

sudo aptitude install apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert

Note that if you follow the article you can safely skip the entire PHP section and simply use the Apache section unless you actually have a need to install PHP5. If you didn't follow the article and just used the command above now might be a good time to visit your slice IP in your browser and ensure you get the default "It works!" page from apache.

If you do not get the "It works!" page, apache may not have installed correctly, you may have an existing apache install, or iptables may be blocking port 80. Check all of those things before continuing as you will need a working and accessible install of apache to continue much further.

mod_python Installation

Installing mod_python is actually dead simple:

sudo aptitude install libapache2-mod-python

That is seriously all there is to it! You will want to give apache a restart (mod_python won't be enabled until you do).

sudo /etc/init.d/apache2 restart

In the next article we'll look at deploying a Django application with mod_python.

Ben H.

© 2015 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

See license specifics and DISCLAIMER