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.

3.7 3 votes
Article Rating
Subscribe
Notify of
guest

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

6 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Cell
Cell

Thanks a ton!

Pritam

Thank you so much for the help

Kombe
Kombe

You saved my life. Now I feel so stupid. Good job with the post

negan from TWD

thank you , i was about cry over it man . this is so stupid man thnx

sasan
sasan

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…

Edward
Edward

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!

6
0
Would love your thoughts, please comment.x
()
x