I’ve been getting this error message for a while now, but actually the code works fine and runs as expected, the line causing the error is this:
templates/users/dashboard.html->
<link rel="stylesheet" href="{% static 'css/dashboard.css' %}">
when i remove the quotations i get a deferent error:
<link rel="stylesheet" href={% static 'css/dashboard.css' %}>
ERROR: Invalid Token. Expected stringStart but found tag start "{%" instead.
when i completely remove the line i get the same erro on the first tag with href
:
<a href="{% url 'login' %}">Logout</a>
ERROR: Invalid Token. Expected stringEnd but found tag start "{%" instead.
i suspect that its a vscode issue, because the code runs flawlessly, and it only catches the error when i clean the code(format), so as long as i open vscode and never hit (ctrl+shidt+f
) i dont get the error message, is there a solution for this?
3
Answers
Had the same behaviour today in vs code. Problem was a conflict within the django extensions in vs code, which I had installed. You may check your django extensions.
I was not able to find a way to "fix" this same error. Reinstalling the Django template extension fixed it for me.
I had the same error which I fixed by disabling the extension Django Template Support v1.0.23 by junstyle. In exchange, I installed Django v1.10.0 by Baptiste Darthenay. All seems fine now. Not saying either of these extensions is better or worst than another. It is just the way I found to fix the highlighted problem.