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'm trying to deploy a Django application, but I've hit a brick wall. On Debian (latest), I've run these commands so far:

apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-python python-django

I've tried adding the module manually in the Apache 2 config files, but to be honest I'm totally lost. It's totally different to Apache version 1 which I used years ago.

Syntax error on line 7 of /etc/apache2/sites-enabled/000-default:
Invalid command 'PythonHandler', perhaps misspelled or defined by a module not included in the server configuration

I've added the following to my sites-available/default file, between the tags.

    <Location "/">
              SetHandler python-program
              PythonHandler django.core.handlers.modpython
              SetEnv DJANGO_SETTINGS_MODULE hellodjango1.settings
              PythonDebug Off
    </Location>

Here's what tutorials I've used so far, without much luck:

share|improve this question
add comment

5 Answers

Have you enabled mod_python.load in mods-enabled? You can do this by just creating a softlink to the same file in mods-available.

share|improve this answer
    
txwikinger, thanks for the tip - I had to manually create the .load file. Which is odd since I assumed it'd already be there. –  nbolton Aug 23 '09 at 10:55
add comment

more easy way to do it

a2enmod python

share|improve this answer
add comment

On ubuntu, you need to:

apt-get install libapache2-mod-python

share|improve this answer
add comment

If you're using Gentoo, define -D PYTHON in /etc/conf.d/apache2

share|improve this answer
add comment
up vote -1 down vote accepted

Looks like I had to manually create the python.load file, weird. Anyway, these two commands fixed it:

echo "LoadModule python_module /usr/lib/apache2/modules/mod_python.so" > /etc/apache2/mods-available/python.load
ln -s ../mods-available/python.load etc/apache2/mods-enabled/python.load
share|improve this answer
    
Hmm, a down-vote. Maybe I will review which answer works best for this question. –  nbolton Dec 6 '10 at 22:17
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.