【问题标题】:301 MOVED PERMANENTLY, with python fcgi301 永久移动,使用 python fcgi
【发布时间】:2016-07-03 22:29:00
【问题描述】:

我正在使用一个相当便宜的共享主机帐户尝试使用 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>. 

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

【问题讨论】:

  • 为什么路径前有波浪线?
  • 我尝试了几种不同的方法,但始终获得相同的输出。也试过 /domains/mini

标签: python fastcgi


【解决方案1】:

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

pip install Werkzeug==0.9.6

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

【讨论】:

    猜你喜欢
    • 2018-05-24
    • 2019-11-04
    • 2012-07-10
    • 2013-09-26
    • 2019-10-14
    • 2018-06-18
    • 2018-06-23
    • 2021-08-13
    • 1970-01-01
    相关资源
    最近更新 更多