2
votes

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
Try to clear your browser cache.user7141836
Django will detect changes only for .py files and restart automatically. If you change html or js or css server does not restart.Abijith Mg
The problem could be either in your template settings (although Django does not cache templates by default) or perhaps in the way you are mounting files in your virtual machine. You haven't given enough information to help further.Alasdair
@AbijithMg the Django runserver may not reload, but when you do return render(request, 'my_template.html', {}), Django will load the template file each time the view runs by default.Alasdair

1 Answers

1
votes

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.