1234567891011121314151617181920212223242526 |
- #!/usr/bin/python
- # -*- coding=utf-8 -*-
- # @Create Time: 2024-01-08 10:17:43
- # @Last Modified time: 2024-01-17 17:43:47
- from flask import Flask
- from config import config, Config
- def create_app(config_name):
- app = Flask(__name__)
- app.config.from_object(config[config_name])
- config[config_name].init_app(app)
- from . import models
- models.db.init_app(app)
- models.init_app(app)
- from .api import api as api_blueprint
- app.register_blueprint(api_blueprint, url_prefix='/api')
- from .main import main as main_blueprint
- app.register_blueprint(main_blueprint)
- return app
|