16 lines
368 B
Python
16 lines
368 B
Python
from flask import Flask
|
|
from flask_cors import CORS
|
|
from .database import init_db
|
|
|
|
def create_app():
|
|
app = Flask(__name__, template_folder='../templates', static_folder='../static')
|
|
CORS(app) # 启用CORS
|
|
|
|
with app.app_context():
|
|
init_db()
|
|
|
|
from .routes import main as main_blueprint
|
|
app.register_blueprint(main_blueprint)
|
|
|
|
return app
|