How To Fix Django: TemplateSyntaxError: Could Not Parse The Remainder Error In Template File

When I develop my Django app example, I meet an error with TemplateSyntaxError: Could Not Parse The Remainder error message like below. This error is so strange but so simple to fix, but it cost me a lot of time. So I want to write down the solution here for the reader to fix it quickly to save time.

django-templatesyntaxerror-could-not-parse-the-remainder-page

From the above picture, we can locate the source code line of the error, it is below the code line.

<link rel=”stylesheet” href=”{% static ‘css/dept_emp_style.css’ %}”>

If you do not look at the above external CSS stylesheet file include the command carefully, you will find it is so strange, why this line of code throws an error. But if you look at it carefully, you will think the error message is very helpful and clear TemplateSyntaxError: Could Not Parse The Remainder.

The error is because of the Django static tag’s argument ‘css/dept_emp_style.css’, the single quote( ‘ ) is not an English character. Instead, it is a Chinese character. This is a stupid error I think.

So if you meet such an error TemplateSyntaxError: Could Not Parse The Remainder, you should check your statement grammar carefully, especially whether the single or double quote is English character or not, and whether the single or double quote ending correctly.

6 thoughts on “How To Fix Django: TemplateSyntaxError: Could Not Parse The Remainder Error In Template File”

  1. holllllllllllllllllllllllllllllllllllllllly shit……
    thank you sooooooooooooooooooooooooooooooooooo much…
    i was going crazyy….
    i spent a lot of time resolving this stupid error..finally i get it here
    thank you again…

  2. I had copied my {% extends “admin/change_form.html” %} off the internet and didnt realize that the ” was actually another type of character that just looked the same so thank you for this post that put me on the right direction!

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.