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.