我目前正在尝试使用 Django 设置我的第一个主页,但遇到了一些问题。
我的项目所在的服务器正在以 FastCGI 模式运行 Django,他们为我提供了快速指南来设置运行 Django 所需的设置,看起来像这样。
我的网站.fcgi
#!/usr/bin/local/python
import sys, os
sys.path.append("/home/users/username")
from django.core.handler.wsgi import WSGIHandler
from flup.server.fcgi import WSGIServer
os.chdir("/home/users/username/mysite")
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
WSGIServer(WSGIHandler()).run()
.htaccess
Addhandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
当我运行manage.py runfcgi时,我收到以下消息:
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: 200 OK
Content-Type: text/html; charset=utf-8
<!-- The html from my main template --!>
帮助将不胜感激:)