feat(project): 初始化项目结构和配置
- 添加.gitignore和.flaskenv环境配置文件 - 创建Flask应用基础架构,包括models、services、utils模块 - 配置数据库模型User和Setting,集成SQLAlchemy和Alembic迁移 - 添加前端Vue项目结构,包含Element Plus组件库 - 配置前后端API路由和蓝prints模块 - 实现书籍下载服务BookService功能模块 - 添加代码规范配置.editorconfig、.oxfmtrc.json、.oxlintrc.json - 配置VSCode推荐插件和前端构建工具链 - 实现文件服务FileService和相关业务逻辑
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
from flask import Flask
|
||||
from flask_cors import CORS
|
||||
from .extensions import db, migrate
|
||||
from .config import DevelopmentConfig, ProductionConfig, TestingConfig
|
||||
|
||||
|
||||
def create_app(config_name="development"):
|
||||
app = Flask(__name__)
|
||||
CORS(app)
|
||||
app.config.from_object(DevelopmentConfig)
|
||||
|
||||
match config_name:
|
||||
case 'production':
|
||||
app.config.from_object(ProductionConfig)
|
||||
case 'testing':
|
||||
app.config.from_object(TestingConfig)
|
||||
case _:
|
||||
app.config.from_object(DevelopmentConfig)
|
||||
|
||||
db.init_app(app)
|
||||
migrate.init_app(app, db)
|
||||
|
||||
from .blueprints.api import bp as api_bp
|
||||
app.register_blueprint(api_bp, url_prefix='/api')
|
||||
|
||||
return app
|
||||
Reference in New Issue
Block a user