So I use Vagrant/virtual machines in my daily development and with that comes annoyances that my host-machine-only friends don’t experience.
I have my Flask app set up to detect changes and reload whenever static files change.
However, Werkzeug updated and my Flask’s auto reload stopped working.
Turns out it was using inotify and since I’m on a virtual machine, (using the /vagrant/ directory), inotify can’t detect changes on a mounted filesystem.
The solution was to use stat.
from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run(extra_files=my_static_files, reloader_type='stat')
Of course, there’s some disadvantages to stat, it might technically be a watchdog issue, and Werkzeug technically updated a long time ago.
Anyhoo, here’s my quick and dirty solution. I’m posting it ’cause it was hard to search for.