How to auto-restart bottle server when Python file changes using nodemon
Assuming you have a Python script server.py that you want to auto-reload every time the file changes, use the following script using nodemon:
nodemon_start.sh
nodemon -w . --exec python server.pynodemon_start.sh
nodemon -w . --exec python server.pyThe -w . tells nodemon files to watch for changes of all files in the current directory (.)
I generally recommend creating a script start.sh to automatically run this command:
example.sh
#!/bin/sh
nodemon -w . --exec python server.pystart.sh
#!/bin/sh
nodemon -w . --exec python server.pyand then make it executable using
example.sh
chmod a+x start.shchmod_start.sh
chmod a+x start.shNow you can run it using
example.sh
./start.shrun_start.sh
./start.shCheck out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow