【发布时间】:2020-08-09 06:47:57
【问题描述】:
您好,当我访问我的网站时,我收到This site can’t be reached
gunicorn -w 3 flaskodesiapp:create_app
[2020-08-09 02:35:45 -0400] [35946] [INFO] Starting gunicorn 20.0.4
[2020-08-09 02:35:45 -0400] [35946] [INFO] Listening at: http://127.0.0.1:8000 (35946)
[2020-08-09 02:35:45 -0400] [35946] [INFO] Using worker: sync
[2020-08-09 02:35:45 -0400] [35948] [INFO] Booting worker with pid: 35948
[2020-08-09 02:35:45 -0400] [35949] [INFO] Booting worker with pid: 35949
[2020-08-09 02:35:45 -0400] [35950] [INFO] Booting worker with pid: 35950
但执行python3 run.py 运行代码没有问题。因此,我能够看到该应用程序。
运行.py
from flaskodesiapp import create_app
app = create_app()
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5090, debug=True)
wsig.py
from flaskodesiapp import create_app
from .config import Config
if __name__ == "__main__":
app = create_app(config=Config)
app.run(host="0.0.0.0", port=5090, debug=True)
create_app 来自 init.py
from flask import Flask
from flaskodesiapp.config import Config
def create_app(config_class=Config):
app = Flask(__name__)
app.config.from_object(Config)
from flaskodesiapp.odesi.routes import odesi
from flaskodesiapp.errors.handlers import errors
app.register_blueprint(odesi)
app.register_blueprint(errors)
return app
配置仅包含 smtp 凭据。
【问题讨论】:
标签: python-3.x flask gunicorn