Answer a question

I am developing a Flask app on a Linux machine, which does correctly reload itself when I modify a Python source code file (when running in debug mode). Sometimes though I need to develop on a Windows machine, using WSL, but the very same Flask app sources. That basically works fine, however, under WSL the auto-reload feature does not seem to work any more. I can change the Python sources, but nothing happens - I need to manually shutdown and restart the Flask server.

Is this a known bug under WSL? Do I need to start the Flask application in a certain way?
As reference, here is how I start the application under VS Code:

"configurations": [
    {
        "name": "Run Server",
        "type": "python",
        "request": "launch",
        "module": "flask",
        "env": {
            "FLASK_APP": "run.py",
            "FLASK_ENV": "development",
        },
        "args": [
            "run"
        ],
    }
]

... which starts the the Flask appliacation under WSL with these output:

 * Serving Flask app "run.py" (lazy loading)
 * Environment: development
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with inotify reloader
 * Debugger is active!
 * Debugger PIN: 182-804-918

That output looks fine to me, but still no auto-reload.
Any ideas?

Answers

For the records:
The solution to this problem can be found on this Flask GitHub issue.

Logo

学AI,认准AI Studio!GPU算力,限时免费领,邀请好友解锁更多惊喜福利 >>>

更多推荐