Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)

like image 949
saiyan Avatar asked Mar 21 '26 15:03

saiyan


1 Answers

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.

like image 168
zmbq Avatar answered Mar 24 '26 05:03

zmbq



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!