I know this might be a really obvious question, but I'm doing a Django project where I have Javascript in my static files. However, I have noticed that whenever I make a change to those files, my web server doesn't reflect the changes. Is there some migration or something else I need to do to make my web server reflect changes to my static Javascript files? Thanks.
Asked
Active
Viewed 706 times
1
-
1It could be that all you need is refresh while holding shift. Sounds like the browser is simply caching the files. – Oct 01 '20 at 21:13
-
@ChrisG Thanks! Your suggestion worked as well. – M-Chen-3 Dec 02 '20 at 19:55
1 Answers
1
You might want to run python manage.py collectstatic
on the webserver to put the static files in the correct folder. https://docs.djangoproject.com/en/3.1/howto/static-files/
Another possible issue is caching. You could use ManifestStaticFilesStorage https://docs.djangoproject.com/en/3.1/ref/contrib/staticfiles/#manifeststaticfilesstorage to have new filenames whenever a file is updated and escape cache issues.

edgars
- 1,038
- 1
- 7
- 17