尝试将Flask应用程序部署到Google计算引擎上的生产服务器

时间:2019-07-03 17:51:35

标签: flask google-compute-engine waitress

我一直在遵循Flask教程来通过Waitress将应用程序部署到生产环境,但是除了waitress-serve --call 'authr:create_app'?之外还有另一种方法可以做到这一点,我不确定create_app函数应该看起来是什么喜欢我的应用。

这是我的应用程序目录树的样子:

author_script/
├── authr
│   ├── author_script.py
│   ├── css
│   ├── js
│   ├── main.py #this is the main "app.py" with all my routes
│   ├── requirements.txt
│   ├── static
│   └── templates
├── authr.egg-info
├── build
│   └── bdist.linux-x86_64
├── dist
│   └── authr-1.0.0-py3-none-any.whl
├── MANIFEST.in
├── setup.py
└── venv

我已经遵循了本教程中的所有内容:http://flask.pocoo.org/docs/1.0/tutorial/deploy/

我唯一没有做的就是这一步,因为我不确定它将如何为我的应用程序翻译。

authr/__init__.py

def create_app():
    app = ...
    # existing code omitted

    from . import auth
    app.register_blueprint(auth.bp)

    return app

我需要以上代码才能使用Waitress还是有解决办法?

0 个答案:

没有答案
相关问题