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/lo开发者_开发知识库cal/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?
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/
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.
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
精彩评论