31 lines
681 B
Python
31 lines
681 B
Python
|
|
#!/usr/bin/env python
|
|||
|
|
# -*- coding: utf-8 -*-
|
|||
|
|
"""
|
|||
|
|
应用启动文件
|
|||
|
|
"""
|
|||
|
|
|
|||
|
|
import os
|
|||
|
|
import sys
|
|||
|
|
|
|||
|
|
# 添加项目根目录到Python路径
|
|||
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|||
|
|
|
|||
|
|
# 注释掉强制设置数据库URL为SQLite的代码,让应用从.env文件读取配置
|
|||
|
|
# os.environ['DATABASE_URL'] = 'sqlite:///kamaxitong.db'
|
|||
|
|
|
|||
|
|
from app import create_app
|
|||
|
|
|
|||
|
|
# 创建应用实例
|
|||
|
|
app = create_app()
|
|||
|
|
|
|||
|
|
if __name__ == '__main__':
|
|||
|
|
# 获取配置
|
|||
|
|
config_name = os.environ.get('FLASK_CONFIG') or 'development'
|
|||
|
|
print(f"Configuration name: {config_name}")
|
|||
|
|
|
|||
|
|
# 运行应用
|
|||
|
|
app.run(
|
|||
|
|
host='0.0.0.0',
|
|||
|
|
port=5000,
|
|||
|
|
debug=True
|
|||
|
|
)
|