Django Development server doesn't detect changes in my html files

别说谁变了你拦得住时间么 提交于 2019-12-25 09:16:53

问题


I am using django 1.7.5 for my project .I am using vagrant and virtual box for my project.I successfully ran the server and detected changes on my browser.But,the problem is After making any changes in the html file,I had to restart the server to see changes on the browser.

Does django 1.7.5 detect changes on the go?(like make change the file,refresh the browser,see changes.) or this is not related to django version?

My website is very old. so it uses 1.7.5.How to enable caching in my version of django 1.7.5. I got this in my settings file.

   CACHES = { 'default': { 'BACKEND': 

'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': 
os.environ.get('CACHES_DEFAULT_LOCATION', '127.0.0.1:11211') }
, 'social': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': os.environ.get('CACHES_SOCIAL_LOCATION', '127.0.0.1:11211') 
} }

Edit: My question might be wrong specifically. The changes I made in the html file doesn't reflect on browser. It use to reflect when I run the example project from django locally (without using virtualbox)


回答1:


Django detects changes in Python files, it does not detect changes in html files as those are rendered every time you access the server (unless you've enabled caching).

The browser may be the cause of this, as it may cache HTML files and not even access the server to get them again.

By the way, why not upgrade to the latest Django? 1.7 is quite old.



来源:https://stackoverflow.com/questions/42782337/django-development-server-doesnt-detect-changes-in-my-html-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!