Python内部服务器错误

时间:2015-07-30 11:39:16

标签: python html .htaccess

我是Python Web Development的新手,我编写了以下代码并上传到我的服务器(public_html)文件夹的根目录中:

import web
urls = ('/','index')
app = web.application(urls, globals())
class index:
    def GET(self):
        greeting = "Hello World"
        return greeting

app.run()

我的.htaccess文件是:

AddType text/html py
AddHandler cgi-script .py .cgi

当我打开我的网站时,我收到以下错误:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

我的cPanel错误日志显示:

[Thu Jul 30 10:44:42 2015] [error] [client 1.1.1.1] client denied by server configuration: /home/user/public_html/.htaccess
[Thu Jul 30 10:36:53 2015] [error] [client 1.1.1.1] attempt to invoke directory as script: /home/user/public_html/cgi-bin/, referer: http://example.com/

我搜索的大多数地方都说.py文件应该获得755的许可。我做了同样的事情,另外,甚至给了.htaccess文件755的权限。

可能的解决方案是什么?

1 个答案:

答案 0 :(得分:1)

我认为它既没有py或.htaccess文件权限的问题,它的所有关于提供对配置部分中.htaccess下的文件的访问...检查出来!!!!