Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace deprecated decorator before_first_request #320

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

PanderMusubi
Copy link
Collaborator

No description provided.

@PanderMusubi PanderMusubi requested a review from greyli September 19, 2023 00:01
@PanderMusubi PanderMusubi added the bug Something isn't working label Sep 19, 2023
CHANGES.rst Outdated Show resolved Hide resolved
@greyli greyli self-requested a review September 22, 2023 00:46
@greyli greyli merged commit 85dd170 into helloflask:master Sep 22, 2023
@greyli
Copy link
Member

greyli commented Sep 22, 2023

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.

@PanderMusubi
Copy link
Collaborator Author

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.

@PanderMusubi PanderMusubi deleted the before_first_request branch September 22, 2023 11:04
@greyli
Copy link
Member

greyli commented Oct 10, 2023

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.

@PanderMusubi
Copy link
Collaborator Author

Was this also the case with the before_frist_request implementation? Asking for also other implementations that are not this demo.

@greyli
Copy link
Member

greyli commented Oct 12, 2023

No. That's a callback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants