如何使用 entr 在 Python 文件更改时自动重启 bottle 服务器

注意:我不再推荐使用 entr,因为对我来说它不可靠。我推荐使用 nodemon 代替,参见如何使用 nodemon 在 Python 文件更改时自动重启 bottle 服务器

假设你有一个 Python 脚本 server.py,你想在每次文件更改时自动重新加载,使用以下 entr 脚本:

entr_restart_bottle.sh
ls *.py | entr python server.py

ls *.py 告诉 entr 要监视哪些文件的更改。


Check out similar posts by category: Python