I have a VirtualBox machine managed by Vagrant. On this machine I run a Django development web server:
./manage.py runserver 0.0.0.0:8080
The codebase is big so for faster code reload I installed pyinotify
. Django supports it since 1.7. I'm using 1.7.
The codebase sits in a synced folder (NFS) and I'm using Sublime 3 to edit files on my host machine (OS X).
However inotify doesn't go well with NFS and the code autoreload do not work.
How do I restart a dev server in the VM?
I have a rudimentary web server running next to a dev server. This simple web server listens for a request (on a different port) and touches the project's manage.py. This in turn triggers a restart:
reloader.py
On the host machine I use a simple shell command to watch for file changes and hit the reloader's endpoint:
watcher.sh
Where
watchmedo
is a utility from watchdog.