使用 apache 部署 django 时遇到问题
您好,我在 Django 尝试使用 apache 将其部署到服务器上时遇到问题。由于某种原因,当我在 httpd.conf 文件中写入此信息时。
<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>
当我重新启动 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.
有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这个错误几乎是不言自明的(第二行对你来说很重要):
PythonHandler是apache未知的命令。这是 mod_python 所知的“模块命令”。因此,如果丢失,则表示命令无效(或由不在...中的模块定义)。
所以请确保 mod_python 已安装。
无论如何,你可能知道它,但只需遵循此文档 http://docs.djangoproject .com/en/dev/howto/deployment/modpython/
this error is pretty much self explanatory (second line is important to you):
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/
另外,我建议您使用 mod_wsgi 而不是mod_python。请参阅本页顶部的弃用警告:http://docs.djangoproject.com /en/1.2/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/
python_mod
未安装或未在httpd.conf
中配置。如果您已安装它,请在
httpd.conf
中添加以下行:python_mod
is not installed or not configured inhttpd.conf
.If you have installed it, then add this line below in
httpd.conf
: