-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Reloader is breaking the execution if using Poetry scripts #2588
Comments
If I modify Werkzeug's reloader to print out
This points to an issue with Poetry, it is breaking the documented behavior of That said, Werkzeug still wouldn't support this, as the Since you're using Flask, you should use the |
I opened #2589 to better describe what I was working on already. It will fix this issue as well. The |
thanks @davidism for the detailed explanation. Tomorrow I'll open an issue on the Poetry repository 😁 Regarding using Flask CLI, I'm already doing that. I found that issue because I wanted to experiment with Poetry Scripts and accidentally found it 😁 |
The Flask reloader is apparently using the executed command instead of the actual Python package. When I try running with Poetry scripts, it throws an error (only if the reloader is enabled)
To replicate the behavior you can create a new Poetry Python package, install Flask and create the following Poetry script:
(as you can imagine, you need to have a
run
function inside a file calledmain.py
within a folder calledmy_package
that will create the app and run it)Now, you can set
FLASK_DEBUG=0
and run it withpoetry run dev
. It will work (as expected).After this, you can set
FLASK_DEBUG=1
and run the same command, it will fail saying that it wasn't able to find thedev
file. I've explored it a little bit, and the problem isn't the debugger, but the reloader (if you launch with the debugger, but without the reloader it works)It seems the reloader somehow uses the executed command (
dev
) as the expected Python file to be used upon reloading and, because of that, it can't find the file and throws an error.Environment:
The text was updated successfully, but these errors were encountered: