Python的CGI显示500内部服务器错误 [英] Python CGI Showing 500 internal server error

查看:1982
本文介绍了Python的CGI显示500内部服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个Python开发者,但是,当我把我的文件中一个cgi-bin目录 并运行它通过我的浏览器的显示500内部服务器错误。

I'm a python developer, but when i'm putting my file inside a cgi-bin directory and running it through my browser its showing 500 internal server error.

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

print "Content-Type: text/plain;charset=utf-8"
print

print "Hello World!"

这是我的test.py. Filelocation: http://mywebsite.com/cgi-bin/test.py

This is my test.py. Filelocation : http://mywebsite.com/cgi-bin/test.py

.htaccess文件:

.htaccess file :

 RewriteEngine on
 Options +ExecCGI AddHandler cgi-script cgi py
 Options +ExecCGI SetHandler cgi-script

请给些建议!

推荐答案

假设服务器建立正常的最可能的问题是忘记设置Python文件拷贝到cgi-bin目录后的可执行文件。

Assuming that the server set up is OK the most likely problem is forgetting to set the python file to executable after copy to the cgi-bin directory.

这篇关于Python的CGI显示500内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆