简体   繁体   English

Python内部服务器错误

[英]Python Internal Server Error

I'm new to Python Web Development and I have written the following code and uploaded into the root of my server ( public_html ) folder: 我是Python Web开发的新手,我编写了以下代码并将其上传到服务器的根目录( public_html ):

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

app.run()

My .htaccess file is: 我的.htaccess文件是:

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

When I open my site, I get the following error: 当我打开网站时,出现以下错误:

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.

My cPanel Error Log shows: 我的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/

Most of the places I searched for said that the .py file should be given permission 755. I did the same and in addition, even gave 755 permission to .htaccess file. 我搜索过的大多数地方都说应该给.py文件755权限。我也做了同样的事情,此外,甚至给了.htaccess文件755权限。

What may be the probable solution? 可能的解决方案是什么?

我相信它与py或.htaccess文件权限都没有问题,它的全部有关在配置部分中提供对.htaccess下文件的访问权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM