1

Hello I am having a problem with Django trying to get it deployed on a server using apache. for some reason when I write this information in my httpd.conf file.

<location "/mysite">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    PythonOption django.root /mysite
    PythonDebug off
    PythonPath "['/user/local/src/djcode','/user/local/src/djcode/mysite'] + sys.path"
</Location>

I get this error when I restart apache.

Syntax error on line 3 of /etc/apache2/httpd.conf:
Invalid command 'PythonHandler', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.

Any ideas?

4
  • Have you installed mod_python modpython.org? Commented Nov 8, 2010 at 10:12
  • Now I think about it, when I go to my modules folder. I do not have mod_python.so iin my modules folder. This may be the problem. Commented Nov 8, 2010 at 10:52
  • I have installed mod_python.so using all default configurations. I cannot see in in /usr/local/apache2/modules/. It is not even in /usr/lib/apache2/modules. so when I restart apache it gives the same error undefined. Commented Nov 8, 2010 at 14:01
  • Ok I have finally installed it. But my god thee where to many problems I had installing it. One I need a lot of lib and binary like flex. Also I did not knew but I realised there was a problem with the source code so if I did not go to this page I think I would not have been able to do it.issues.apache.org/jira/browse/MODPYTHON-249 Commented Nov 8, 2010 at 16:40

3 Answers 3

2

this error is pretty much self explanatory (second line is important to you):

Invalid command 'PythonHandler', perhaps misspelled 
or defined by a module not included in the server configuration

PythonHandler is a command unknown by apache. It's a "module command" known by mod_python. So if missing it says invalid command (OR defined by module not in...).

So make sure mod_python is installed.

You might know it anyways, but just follow this document http://docs.djangoproject.com/en/dev/howto/deployment/modpython/

Sign up to request clarification or add additional context in comments.

1 Comment

On Centos, yum install mod_python worked for me and got me past this error.
1

Also, i recommend you use mod_wsgi instead of mod_python. See deprecation warning on top of this page: http://docs.djangoproject.com/en/1.2/howto/deployment/modpython/

Support for mod_python will be deprecated in a future release of Django. If you are configuring a new deployment, you are strongly encouraged to consider using mod_wsgi or any of the other supported backends.

Comments

1

python_mod is not installed or not configured in httpd.conf. If you have installed it, then add this line below in httpd.conf:

LoadModule python_module modules/mod_python.so

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.