301永久移动,使用python fcgi

时间:2016-07-03 22:29:01

标签: python fastcgi

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

托管公司没有帮我这个。关于下一步该做什么的任何想法?

1 个答案:

答案 0 :(得分:2)

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

vm.config = {
    global: { useUTC : false },
    options: {
        ignoreHiddenSeries: false,
        chart: {
            backgroundColor: '#474747',
            title: { text: '' },
            subtitle: { text: '' },
            renderTo: 'chart1',
            zoomType: 'x',
            events: {
                load: () => {}
            }
        },
        rangeSelector: {enabled: false},
        tooltip: {
            shared: true,
            useHTML: true,
            backgroundColor: null,
            borderWidth: 0,
            shadow: false,
            formatter: function(tooltipObj) {
                return TooltipFactory.formatTooltip(tooltipObj, this.points);
            }
        },
        exporting: {enabled: false},
        plotOptions: {
            series: {
                turboThreshold: 0,
                    events: {
                        click: chartClick
                    }
            },
            area:   { stacking: 'normal' },
            column: { stacking: 'normal ' }
        }
    },

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

相关问题