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 above picture we can locate the source code line of the error, it is below code line.

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

If you do not look at above external css stylesheet file include command carefully, you will find it is so strange, why this line of code throw 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 charactor, instead it is a chinese charactor. 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 singe or double quote is english charactor or not, and whether the single or double quote ending correctly.

READ :   How To Run / Show Raw SQL Quries In Django

1 Comment

  1. 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 Reply

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.