WSGIServer:缺少WSGI所需的FastCGI

2024-06-17 12:55:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图从我的主机运行Django中的项目,但在已经尝试运行该项目时,此错误显示在终端中。

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: 400 Bad Request
Content-Type: text/html

为了将它们放在上下文中,我遵循本教程:https://soporte-latam.hostgator.com/hc/es-419/articles/115002998391--Cómo-instalar-Django-en-entornos-compartidos-,我的宿主通过了我,让我能够安装Django,完成了所有已经完成的步骤,以测试它是否工作,并显示错误。 共享主机上的我的文件夹如下所示:

/home/username/public_html/.htaccess

/home/username/public_html/index.fcgi

这里是我的.htaccess

AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_index} !-f
RewriteRule ^(.*)$ index.fcgi/$1 [QSA,L]

这里是我的索引.fcgi

#!/home4/quarkedi/.virtualenv/bin/python
 
import os, sys
 
from flup.server.fcgi import WSGIServer
from django.core.wsgi import get_wsgi_application
 
sys.path.insert(0, "/home4/quarkedi/Quark/Quark")
os.environ['DJANGO_SETTINGS_MODULE'] = "settings"
 
WSGIServer(get_wsgi_application()).run()

有什么想法吗?谢谢大家!


Tags: 项目djangoimportwsgiindexbyserverparam