hackforla / HomeUniteUs

We're working with community non-profits who have a Host Home or empty bedrooms initiative to develop a workflow management tool to make the process scalable (across all providers), reduce institutional bias, and effectively capture data.
https://homeunite.us/
GNU General Public License v2.0
36 stars 21 forks source link

Add Debugging to README #521

Closed ju1es closed 10 months ago

ju1es commented 11 months ago

Problem

Unable to step through/debug requests to api.

Solution

Resources

erikguntner commented 11 months ago

I'll check out the branch and play around with it a bit. So basically the hot reloading feature in Flask interferes with the VS Code debugger?

ju1es commented 11 months ago

@erikguntner exactly yep

ju1es commented 11 months ago

closing this as I'm adding the toggling in a separate pr

ju1es commented 11 months ago

@erikguntner updating only the readme as I merged the changes to toggle the 'use_reloader' config in a separate pr

paulespinosa commented 11 months ago

@ju1es @erikguntner When using an external debugger, the Flask external debugging documentation suggests to disable the built-in debugger and reloader:

app.run(debug=True, use_debugger=False, use_reloader=False)

Keep in mind that this app.run() function is only used for local development: connexion API doc and flask API doc

The Flask run API documentation tells us: "It is not recommended to use this function for development with automatic reloading as this is badly supported. Instead you should be using the flask command line script’s run support."

However, in our case, we use connexion as our application framework. Connexion comes with its own command line interface (CLI), BUT it works by calling the Flask.run() function and it does not provide a way to disable the built-in debugger and reloader (connexion cli code). Therefore, our default configs for reloader can be set to false and have a comment about why the reloader config should stay False.

ju1es commented 10 months ago

@paulespinosa ah! thank you for digging into that. I'm a little confused though. When we debug, we set our breakpoints, set flask's reloader and debugger to false, then start the api via the following command?

python3 -m openapi_server
paulespinosa commented 10 months ago

That looks right.

On July 16, 2023 3:52:09 AM GMT+07:00, ju1es @.***> wrote:

@paulespinosa ah! thank you for digging into that. I'm a little confused though. When we debug, we set our breakpoints, set flask's reloader and debugger to false, then start the api via the following command?

python3 -m openapi_server

-- Reply to this email directly or view it on GitHub: https://github.com/hackforla/HomeUniteUs/pull/521#issuecomment-1636884437 You are receiving this because you were mentioned.

Message ID: @.***>