![将 web.py 项目部署到 Bluehost,WSGIServer:缺少 FastCGI 错误](https://linux22.com/image/1488085/%E5%B0%86%20web.py%20%E9%A1%B9%E7%9B%AE%E9%83%A8%E7%BD%B2%E5%88%B0%20Bluehost%EF%BC%8CWSGIServer%EF%BC%9A%E7%BC%BA%E5%B0%91%20FastCGI%20%E9%94%99%E8%AF%AF.png)
我正在尝试使用以下方法将一个非常简单的 web.py 应用程序部署到我的 Bluehost 网站这些说明。这是我的主要 python 文件:
#!/usr/bin/python
import web
from web import form
import whitelistchecker
render = web.template.render('templates/')
urls = ('/', 'index')
app = web.application(urls, globals())
myform = form.Form(
form.Textarea('whitelist', description = "", rows = 10, cols = 50)
)
output = None
class index:
def GET(self):
form = myform()
return render.inputform(form, output)
def POST(self):
form = myform()
if not form.validates():
return render.inputform(form, output)
else:
return render.inputform(form, whitelistchecker.ReportRejectedSevere(form['whitelist'].value))
web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
if __name__=="__main__":
web.internalerror = web.debugerror
app.run()
无需线路,本地运行良好web.wsgi.runwsgi
。
这是我的.htaccess
文件:
allow from all
SetHandler fcgid-script
Options +ExecCGI
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ interface.py/$1 [PT]
它与教程中的内容完全相同。这两个文件都位于我的public_html
目录中的同一目录中,其中包含此应用程序的一些其他文件(模板和实用程序 - 与部署无关)。我收到以下错误:
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Status: 404 Not Found
Content-Type: text/html
我不知道该如何解决这个问题。如果能得到帮助,我将不胜感激。我也无法运行与教程完全相同的代码,所以我认为这不是只是我的代码。