Sunday, 16 October 2022

Flask auto-reload functionality not working with Pycharm Remote Deployment

It's hard to remember when, but at one point the auto-reload function of Flask started to not work anymore in my project. This is the output upon starting my app :

FLASK_APP = back/python/app/app.py:app
FLASK_ENV = development
FLASK_DEBUG = 1
In folder C:/path/to/project
ssh://[VirtualMachineIP]:22/root/env/bin/python3.7 -u -m flask run -h 0.0.0.0 -p 1234
 * Serving Flask app 'back/python/app/app.py:app' (lazy loading)
 * Environment: development
 * Debug mode: on
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://[VirtualMachineIP]:1234/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 106-048-128

The development environment and Debug mode are both on. Thus, upon saving changes in a file (while the app is deployed) I get the usual message :

 * Detected change in '/path/to/changed/file.py', reloading

Signaling that the app is reloading with the new code. Except it doesn't reload anything, and the message doesn't appear on any further changes until I'm forced to restart the app.

PyCharms runs on Windows and communicates via ssh to my Virtual Machine, where the code is executed. I have installed the following modules:

  • flask
  • flask-socketio
  • eventlet
  • flask-cors

Any help is welcomed. Thanks :)



from Flask auto-reload functionality not working with Pycharm Remote Deployment

No comments:

Post a Comment