Cgi不执行python

发布于 2024-08-20 08:14:37 字数 1020 浏览 3 评论 0原文

我在让 CGI 适用于 Python 时遇到问题。

我已

Options ExecCGI
AddHandler cgi-script cgi py pl

在 /etc/apache2/sites-available/default 内 添加

现在 Perl 可以工作,但 Python 给出 500 内部服务器错误..

编辑:

如果当前的“默认”文件

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride AuthConfig
            Order allow,deny
            allow from all

            AddHandler mod_python .py
            PythonHandler mod_python.publisher
            PythonDebug On
    </Directory>

    ScriptAlias /cgi-bin/ /var/www/cgi-bin/
    <Directory "/var/www/cgi-bin/">
            Options +ExecCGI
            AddHandler cgi-script .cgi .py .pl
            Allow from all
    </Directory>

有什么想法吗?

I'm having a problem getting CGI to work for Python.

I've added

Options ExecCGI
AddHandler cgi-script cgi py pl

inside /etc/apache2/sites-available/default within

and now Perl works, but Python gives out a 500 Internal Server Error..

EDIT:

This if the current 'default' file

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride AuthConfig
            Order allow,deny
            allow from all

            AddHandler mod_python .py
            PythonHandler mod_python.publisher
            PythonDebug On
    </Directory>

    ScriptAlias /cgi-bin/ /var/www/cgi-bin/
    <Directory "/var/www/cgi-bin/">
            Options +ExecCGI
            AddHandler cgi-script .cgi .py .pl
            Allow from all
    </Directory>

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

罗罗贝儿 2024-08-27 08:14:37

尝试将 .py 文件重命名为 .cgi,它对我有用。

Try renaming the .py files to .cgi, it worked for me.

我喜欢麦丽素 2024-08-27 08:14:37

如果可以满足您的需求,请尝试使用 python CGI 服务器而不是 apache。

python -m CGIHTTPServer {port number:default 8000}

Try using the python CGI server instead of apache,if that can meet your needs.

python -m CGIHTTPServer {port number:default 8000}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文