2016-06-29 81 views
0

我正在阅读http://fgimian.github.io/blog/2014/02/14/serving-a-python-flask-website-on-hostmonster/,试图在共享主机上部署烧瓶应用程序。用fcgi运行烧瓶

我用https://github.com/wdm0006/cookiecutter-flask作为我的应用程序,以及我在哪里,我的工作修改FCGI脚本阶段:

#!/home/fots/.virtualenv/flaskage/bin/python 
import sys 

from flup.server.fcgi import WSGIServer 

sys.path.insert(0, '/home/fots/flaskage') 
from application import create_app 

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

特别是18.11是使用manage.py文件运行(https://github.com/wdm0006/cookiecutter-flask/blob/master/%7B%7Bcookiecutter.app_name%7D%7D/manage.py),包含:

if os.environ.get("{{cookiecutter.app_name | upper}}_ENV") == 'prod': 
    app = create_app(ProdConfig) 
else: 
    app = create_app(DevConfig) 

HERE = os.path.abspath(os.path.dirname(__file__)) 
TEST_PATH = os.path.join(HERE, 'tests') 

manager = Manager(app) 


........ 

if __name__ == '__main__': 
manager.run() 

我不知道如何使用FCGI脚本

回答

1

你不修改manage.py运行它。 manage.py用于管理本地开发。 fcgi.py用于设置生产应用程序。 fcgi.py已导入应用程序工厂并告诉它使用什么环境(create_app('production')),因此除非该调用出现问题,否则您已拥有所需的所有内容。

+0

非常感谢。 – user61629