How to get liveserver to render django templates?


I’ve been messing around with a tutorial site, and I found that my VS Code LiveServer plugin doesn’t work properly when I try to open Django templates. The CSS I applied is missing (although everything renders correctly in my local development sever), and the template language code is actually printed to the screen rather than executed (see image below). My liveserver plugin appears to be working with html files outside of Django.

(1) Right now I’m right clicking and selecting "Open with Liveserver." Is this wrong for Django? The liveserver docs recommend trying to "visit the Actual Server Address: http://localhost/[workspace], not the VS Code extension’s Live Server Address:". I tried including the file path in place of [workspace], but no luck. What do I do here?

(2) I saw in another thread where someone recommended their own solution, here. I’m not sure where I’m supposed to run the ‘./ livereload’ command, but it’s not working in command prompt. What is the difference between ‘./’ and ‘py’? And will this solution be any better than the VS Code plugin?

enter image description here


I have had the same problem as you and managed to get it working with the link you included in point (2) of your post. You may have gotten sorted by now, but I thought I’d post it here in case.

First I went to my console and ran:

pip install livereload

which was installed successfully. Then I added 'livereload' to my installed apps in my file. E.g…


Then I went to the directory containing my file on the terminal and ran

./ livereload

and this provided me with a link to a live update server. Previously I had been running a server with "python runserver", so this is to replace that command.
Now when I save any changes I make in my IDE, they update live on the browser.
Sorry that I haven’t included any screenshot images for clarity, I wasn’t able to for some reason.

Answered By – GitMoney

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published