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

Simply flask app definition #2168

Merged
merged 7 commits into from Feb 6, 2023
Merged

Simply flask app definition #2168

merged 7 commits into from Feb 6, 2023

Conversation

ABrain7710
Copy link
Contributor

@ABrain7710 ABrain7710 commented Feb 4, 2023

Description

  • Simplify the definition of the flask app in the server.py file.
  • The flask app is no longer defined in a class. It was defined as a class before so the engine could be passed to all the routes through the create_routes() function that had to be defined in each file that had routes. Also the routes were loaded onto the flask app by importing the create_routes() function from each routes file. This complexity was making it difficult for developers to add routes and understand how they are added to the flask app. To minimize this complexity I have changed the flask app to be defined at the module level rather than in a class. Also the routes are added to the flask app by importing the routes from all the different routes files. Then each routes file now imports the engine and flask app from the server.py file rather than defining a create_routes() function`.
  • The flask app is also no longer preloaded. I did this so we don't have to worry as much about the database engine and when it is created.
  • The metrics are still loaded the same way they were before, just all the functionality has been moved into the module rather than on the Server class
  • Also the transform function was renamed to route_transform due to a conflict with another libraries function

Signed commits

  • Yes, I signed my commits.

Signed-off-by: Andrew Brain <andrewbrain2019@gmail.com>
ABrain7710 and others added 4 commits February 3, 2023 20:56
Signed-off-by: Andrew Brain <61482022+ABrain7710@users.noreply.github.com>
Signed-off-by: Andrew Brain <61482022+ABrain7710@users.noreply.github.com>
Signed-off-by: Andrew Brain <andrewbrain2019@gmail.com>
Signed-off-by: Andrew Brain <andrewbrain2019@gmail.com>
@ABrain7710 ABrain7710 marked this pull request as ready for review February 4, 2023 03:53
@sgoggins sgoggins merged commit 06e75c1 into dev Feb 6, 2023
@sgoggins sgoggins deleted the flask_app_changes branch March 13, 2023 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants