How to automatically reload Django when files change?

后端 未结 4 2027
醉酒成梦
醉酒成梦 2020-12-14 07:57

How to automatically monitor .py, .js and other source code files to restart a Django (or any other for that matter) application and refresh the browser when the source chan

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-14 08:20

    You don't need a browser extension to accomplish auto refreshes. Take a look at https://github.com/tjwalch/django-livereload-server.

    I posted a more extensive answer about this at https://stackoverflow.com/a/36961244/2950621

    It works by using a manage.py command (server) to monitor your .js and other static files. The server sends a signal to the browser via websockets. There is some client-side code injected on every page. The injected code responds to the signal and refresh the browser.

提交回复
热议问题