Django - Changes to HTML Templates Not Working

Posted August 27, 2017 20.6k views
DjangoUbuntu 16.04

So I am SURE that I am missing a basic step here but it’s driving me nuts.

I followed this tutorial to setup my server:

Everything is working as intended, woohoo! Except… now I am making changes to my templates, meaning primarily the HTML parts. Just editing text here and there that I want to update.

Unfortunately, after I do so, and I upload the files via SFTP (FileZilla) to the app directory’s template folder, it does not reflect the changes on the site. I’ve restarted nginx, confirmed the correct files are going to the correct folder (I think?), tried collectstatic again (which does not update anything, though I am only changing the html so I wouldn’t expect it to), and cleared my local cache (tried incognito, etc.).

Am I just missing something regarding how to make those changes reflect on the actual website? I go to my domain (which works to connect to my nginx server) but it just shows the original base.html page that I first uploaded. I can’t get any changes to take place when I visit the site.


1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
6 answers

Just refresh your Gunicorn server like so:

sudo service gunicorn restart

Then refresh your page on the browser and you will see the changes.

  • I’m using Ubuntu 20.0. Made changes to my HTML files. I used “Git Pull Origin Master” to update the files on my server. Afterwards, I restarted gunicorn and Nginx and reloaded daemon. However, nothing seems to update on my domain. I cleared CDN and browser cache but no updates.

I don’t have any caching enabled in Django that I know of:

‘BACKEND’: 'django.template.backends.django.DjangoTemplates’,
'DIRS’: [],
'APP_DIRS’: True,

You need to change your permissions after you’ve uploaded a file over SFTP.

That’s a great bit of advice to try, but I’m not sure which permissions you’re talking about nor which command to do that.

Do I have to do it after every upload?

What’s the better alternative? Push/pull with Git?


This is bizarre! I changed the permissions on the file, and now everytime you refresh the site, it alternates between the good one, and the old one. Like it’s fighting with another file to be displayed??

OK, so it worked but… why?

I mean: what is the level of changes where nginx restart is sufficient, and what is the level where gunicorn needs to be restarted?

Beforehand, pulling changes from Git(hub) was sufficient to reflect those on the site.