Spaces:
No application file
No application file
| import os | |
| from flask import Flask | |
| from flask_cors import CORS | |
| from .extensions import db | |
| from .routes.user import user_bp | |
| from .routes.lora_projects import lora_bp | |
| def create_app(): | |
| app = Flask(__name__, static_folder=os.path.join(os.path.dirname(__file__), 'static')) | |
| app.config['SECRET_KEY'] = 'asdf#FGSgvasgf$5$WGT' | |
| app.config['SQLALCHEMY_DATABASE_URI'] = f"sqlite:///{os.path.join(os.path.dirname(__file__), 'database', 'app.db')}" | |
| app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False | |
| CORS(app) | |
| db.init_app(app) | |
| app.register_blueprint(user_bp, url_prefix='/api') | |
| app.register_blueprint(lora_bp, url_prefix='/api') | |
| with app.app_context(): | |
| import src.models.user | |
| import src.models.lora_project | |
| db.create_all() | |
| return app | |