我刚刚安装了 Django-cms,并且正在使用 FastCGI 和 Flup 在共享主机上运行 Django。当我从终端调用“dispatch.fcgi”时,我得到了正确的 html 输出。但是,当我尝试从浏览器访问我的网站时,我收到了非特定错误:
应用程序引发了未处理的异常。
这是运行 ./dispatch.fcgi 的终端输出:
Status: 200 OK
Vary: Accept-Language, Cookie
X-Frame-Options: SAMEORIGIN
Content-Type: text/html; charset=utf-8
Content-Language: en-us
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
<head>
等等
我已经尝试将 if/else 语句添加到 dispatch.fcgi 文件中,将其错误写入错误日志,但日志为空!
任何人都知道错误发生在哪里?如何获取有关“未处理的异常”的更多信息?
编辑:下面是 dispatch.fcgi:
#!/usr/bin/python
from traceback import format_exc
try:
# current dispatch.fcgi code
import sys
import os
#Make sure to change 'username' to your username!
sys.path.insert(0, '/home/mcgillme/atlas/atlasproject')
os.environ['DJANGO_SETTINGS_MODULE'] = 'testatlas.settings'
import django.core.handlers.wsgi
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
except Exception:
open("/dispatcherrors.txt", "w").write(format_exc())
raise