Closed PanderMusubi closed 9 months ago
What would be a way to improve this? And why only in debug mode? Especially beginners use our examples as a starting point and we don't want to give then the wrong idea. For now, the examples work again but I would like to improve on this in the future.
What would be a way to improve this?
Creating a separate command function to create the database will be better.
And why only in debug mode?
The reloader will reload the app when the code changes, and then the db.create_all will be called again.
Adding a CLI function will require the user to call a separate command before running the application. I'm Okay with the current setup.
Was this also the case with the before_frist_request
implementation? Asking for also other implementations that are not this demo.
No. That's a callback.
This change will cause these codes to be called multiple times since the debug mode is enabled, but it's OK since it's just an example application.