Vikram Kumar
Vikram Kumar

Reputation: 11

TemplateSyntaxError: expected token ',', got 'static'

I am getting following error in given code

TemplateSyntaxError: expected token ',', got 'static'

code:

<img src="{{ url_for('static',filename='foods/paneerparatha.jpg') }}" alt="Paneer Paratha">

Upvotes: 0

Views: 2285

Answers (2)

Akhil prasannan
Akhil prasannan

Reputation: 444

Another way such an error could creep into your code(happened to me) is when you have a comment inside the template that has an unclosed {{}}, but flask also reads that line. This was the comment that was causing the error in myu case.

<!-- {{ url_for('static', filename='./assets/ -->

Upvotes: 0

Thomas Fauskanger
Thomas Fauskanger

Reputation: 2656

Your code seems to be correct, but you might have {{}} inside another {{}} which would cause your error message.

Reference: This might be a duplicate of the following, unanswered question: [ javascript document.write image error ] where that seemed to be the problem.

Upvotes: 3

Related Questions