diff --git a/game_collection/app.py b/game_collection/app.py index adf281a..ec0b2a0 100644 --- a/game_collection/app.py +++ b/game_collection/app.py @@ -9,7 +9,7 @@ app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db.init_app(app) with app.app_context(): - init_db() + init_db() # Ensure the database is initialized before any operations @app.route('/games', methods=['POST']) def add_game(): @@ -38,4 +38,6 @@ def get_games(): } for game in games]) if __name__ == '__main__': + with app.app_context(): + init_db() # Ensure the database is initialized when the app starts app.run(debug=True)