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

AttributeError: 'Flask' object has no attribute 'before_first_request'. #11

Open
hrishikeshrt opened this issue Jun 25, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@hrishikeshrt
Copy link
Owner

Looks like before_first_request is deprecated in 2.2.0 and removed in 2.3.0

Version 2.2.0

before_first_request is deprecated. Run setup code when creating the application instead. Flask#4605`

Version 2.3.0

The app.before_first_request and bp.before_app_first_request decorators are removed.

References: https://flask.palletsprojects.com/en/2.3.x/changes/

@hrishikeshrt hrishikeshrt added the bug Something isn't working label Jun 25, 2023
@hrishikeshrt
Copy link
Owner Author

hrishikeshrt commented Jun 25, 2023

For users,
As an immediate solution, downgrade your Flask
pip install Flask==2.2.2.


In general, two ways this can be handled, Option 2 being the preferred one of course.

  1. Update the requirements.txt file to fix the Flask version to <2.3.0.
  2. Update server code to handle the creation of tables etc., at the start.

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

No branches or pull requests

1 participant