301 永久移动,python fcgi

301 MOVED PERMANENTLY, with python fcgi

我正在使用一个相当便宜的共享主机帐户,试图使用 http://fgimian.github.io/blog/2014/02/14/serving-a-python-flask-website-on-hostmonster 部署一个烧瓶应用程序。我把代码和 fcgi 脚本放在 ~/domains/mini

fcgi 脚本是:

#!/home/username/anaconda2/bin/python
import sys,os
from flup.server.fcgi import WSGIServer
sys.path.insert(0, '/username/domains/mini')
from myflaskapp.settings import Config, SharedConfig
from myflaskapp.app import create_app

if __name__ == '__main__':
    app = create_app(SharedConfig)
    WSGIServer(app).run()

我已经到了最后一步,在命令行测试它时:

[~/domains/mini]# ./mini.fcgi
....
Status: 301 MOVED PERMANENTLY
Content-Type: text/html; charset=utf-8
Content-Length: 241
Location: http://localhost/

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
&lt;title&gt;Redirecting...&lt;/title&gt;
<h1>Redirecting...</h1>
<p>You should be redirected automatically to target URL: <a href="http://localhost/">http://localhost/</a>. 

托管公司没有帮我解决这个问题。对下一步做什么有什么想法吗?

我最近遇到了同样的问题,通过降级我的 Werkzeug 包设法解决了这个问题

pip install Werkzeug==0.9.6

我不清楚为什么这有帮助,但我的 Werkzeug (0.11.10) 版本似乎与 Flask (0.11.1) 不兼容。