【问题标题】:Learning Django: Internal error 500, Invalid command 'PythonHandler'学习 Django:内部错误 500,无效命令“PythonHandler”
【发布时间】:2014-08-19 07:09:09
【问题描述】:

我正在尝试运行一个 Django 项目“strona”。 我确实在 ~/apps 中创建了一个文件夹结构,创建了符号链接并添加到 ~/apps 的 .httpd.conf 中:

SetHandler None

在我的 public_html 的 .httpd.conf 中:

SetHandler python-program

PythonHandler django.core.handlers.wsgi # also tried modpython modpython

SetEnv DJANGO_SETTINGS_MODULE strona.settings

PythonPath "['/usr/local/lib/python2.6', '/home/USERNAME/apps'] + sys.path"
PythonDebug On
#PythonDebug Off

在 error.log 中我得到这个:

[Date] [alert] [client [...]] /[...]/public_html/.htaccess: Invalid command 'PythonHandler', Perhaps misspelled or defined by a module not included in the server configuration

我有 Python 和 Djano,我可以导入 wsgi 模块。 为什么它不起作用?

【问题讨论】:

标签: python django apache python-2.6


【解决方案1】:

我不知道你从哪里得到使用 PythonHandler 的指令,但这是完全错误的。这仅用于 mod_python,它已被弃用多年,不再受 Django 支持。

但是,如果您只是学习 Django,则不应该尝试使用 Apache 运行它。那是为了部署:为了学习,您应该使用内置的开发服务器,如教程中所述。当您准备真正准备好设置 Apache 时,您应该阅读非常全面的部署文档以了解如何配置 mod_wsgi,这正是您应该实际使用的。

【讨论】:

    猜你喜欢
    • 2023-03-05
    • 2019-07-16
    • 2017-08-27
    • 2014-11-24
    • 2015-06-25
    • 2016-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多