Files
2026-09-23 13:56:49 +08:00

20 lines
762 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
开发环境启动入口
- 仅在本地开发时使用,生产环境请用 Gunicorn/uWSGI
- 启动前自动建表(仅限开发便利,生产环境必须使用 flask db upgrade)
- debug=True 开启热重载和交互式调试器(⚠️ 生产环境严禁开启)
"""
from app import create_app, db
app = create_app()
if __name__ == '__main__':
# 在应用上下文中执行数据库操作
with app.app_context():
# ⚠️ create_all() 仅用于开发快速验证
# 生产环境请使用: flask db migrate && flask db upgrade
db.create_all()
# host='0.0.0.0' 允许外部访问(Docker/局域网调试需要)
# 仅监听 127.0.0.1 则只允许本机访问
app.run(debug=True, host='0.0.0.0', port=5000)