This commit is contained in:
@@ -4,16 +4,21 @@ from app.config import Config
|
||||
from app.database import engine
|
||||
from app.models import Base
|
||||
from app.views import bp
|
||||
from app.migrations import run_migrations
|
||||
|
||||
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
||||
def create_app(test_config=None):
|
||||
app = Flask(__name__, instance_relative_config=True)
|
||||
app.config.from_object(Config)
|
||||
|
||||
# Ensure database tables exist
|
||||
# Create database tables if they don't exist
|
||||
Base.metadata.create_all(engine)
|
||||
|
||||
# Register blueprints
|
||||
app.register_blueprint(bp)
|
||||
|
||||
# Run migrations after tables are created
|
||||
with app.app_context():
|
||||
run_migrations(app)
|
||||
|
||||
return app
|
||||
|
||||
Reference in New Issue
Block a user