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 -w . --exec python server.py
The -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:
#!/bin/sh
nodemon -w . --exec python server.py
and then make it executable using
chmod a+x start.sh
Now you can run it using
./start.sh