How to livereload Django templates?

后端 未结 4 595
陌清茗
陌清茗 2021-02-07 04:06

How can I livereload Django templates?

4条回答
  •  余生分开走
    2021-02-07 04:49

    I found a Python native solution which is easy to setup and works well, Python LiveReload (doc).

    pip install livereload
    livereload /path/to/monitor
    

    You still have to install the browser plugin. The plugin and LiveReload use port 35729 to talk (customizable), but you need to point the browser to the port specified via runserver. For example:

    python manage.py runserver example.com:8000
    

    In this case the live reloaded url is http://example.com:8000, and when you change your templates the page is refreshed automatically.

    As a final note, Python live reload can also be used programmatically and supports wsgi applications.

提交回复
热议问题