from flask import Flask
import config
from exts import db
from apps.cms import bp as cms_bp
from apps.common import bp as common_bp
from apps.front import bp as front_bp
from flask_wtf import CSRFProtect
def create_app():
app = Flask(__name__)
# 配置信息
app.config.from_object(config)
# 注册蓝图
app.register_blueprint(cms_bp)
app.register_blueprint(front_bp)
app.register_blueprint(common_bp)
db.init_app(app)
CSRFProtect(app)
return app
if __name__ == '__main__':
app = create_app()
app.run(port=5000)
# app.run(host='0.0.0.0', port=8080)
在终端我输入gunicorn -w 1 -b 127.0.0.1:5000 --access-logfile ./logs/log main:app
跑不起来
提示:
[2023-06-12 15:37:53 +0800] [3649] [INFO] Starting gunicorn 20.1.0
[2023-06-12 15:37:53 +0800] [3649] [ERROR] Connection in use: ('127.0.0.1', 5000)
[2023-06-12 15:37:53 +0800] [3649] [ERROR] Retrying in 1 second.
[2023-06-12 15:37:54 +0800] [3649] [ERROR] Connection in use: ('127.0.0.1', 5000)
[2023-06-12 15:37:54 +0800] [3649] [ERROR] Retrying in 1 second.
[2023-06-12 15:37:55 +0800] [3649] [ERROR] Connection in use: ('127.0.0.1', 5000)
[2023-06-12 15:37:55 +0800] [3649] [ERROR] Retrying in 1 second.
[2023-06-12 15:37:56 +0800] [3649] [ERROR] Connection in use: ('127.0.0.1', 5000)
[2023-06-12 15:37:56 +0800] [3649] [ERROR] Retrying in 1 second.
[2023-06-12 15:37:57 +0800] [3649] [ERROR] Connection in use: ('127.0.0.1', 5000)
[2023-06-12 15:37:57 +0800] [3649] [ERROR] Retrying in 1 second.
[2023-06-12 15:37:58 +0800] [3649] [ERROR] Can't connect to ('127.0.0.1', 5000)