Django Not Reflecting Updates to Javascript Files?

后端 未结 2 1844
鱼传尺愫
鱼传尺愫 2020-12-10 12:14

I have javascript files in my static folder. Django finds and loads them perfectly fine, so I don\'t think there is anything wrong with my configuration of the

相关标签:
2条回答
  • 2020-12-10 12:31

    I believe your browser is caching your js

    you could power refresh your browser, or clear browser cache?

    on chrome control+f5 or shift + f5

    i believe on firefox it is control + shift + r

    0 讨论(0)
  • 2020-12-10 12:34

    Since you are editing JavaScript files and watching for the changes in the browser I assume you are actively developing your Django app and probably using Django's development runserver. There is a better solution than clearing the browser cache and refreshing. If you run a watcher utility that supports the livereload protocol then your browser will automatically refresh whenever you change any static file.

    The django-livereload-server python package provides a spiffy solution. Install it:

    $ pip install django-livereload-server

    Add 'livereload.middleware.LiveReloadScript' to MIDDLEWARE_CLASSES in settings.py.

    Then run

    $ ./manage.py livereload

    before starting the runserver.

    More documentation can be found at the django-livereload-server github site

    0 讨论(0)
提交回复
热议问题