arpanneupane19 / Python-Flask-Authentication-Tutorial

MIT License
94 stars 97 forks source link

Missing Database Table Creation in Flask-SQLAlchemy Application #11

Open Titus210 opened 7 months ago

Titus210 commented 7 months ago

The Flask application currently lacks the essential code responsible for creating the required database tables based on the defined models using SQLAlchemy. Consequently, when attempting to access these tables, a "no such table" error occurs due to their absence in the database schema.

This issue primarily arises from the absence of the db.create_all() method call, which is necessary to generate the tables in the database based on the model definitions. Without this step, the application does not establish the required database structure, leading to errors during execution.

To resolve this issue effectively, the missing db.create_all() method call should be added within the application context to create the necessary database tables based on the defined models.

Solution Link : StackOverflow