Skip to content Skip to sidebar Skip to footer

Jinja2.exceptions.templatesyntaxerror: Expected Token 'end Of Print Statement', Got 'posted'

I'm new to programming and recently a friend of mine gave me a project to work on in order to get myself familiar with the programming environment and language (python in this part

Solution 1:

The line <p>By {{ post.author }} on {{ post.date posted }}</p> is the issue here

Replace it with <p>By {{ post.author }} on {{ post.date_posted }}</p>

post.date_posted is a variable and should be same as the one in your models, And spaces between them are obviously syntax errors(typos)

Solution 2:

You have to do <p>By {{ post['author'] }} on {{ post['date posted'] }} to make it work. it is a dict. So you have to get the values with indicies instead of calls.

Post a Comment for "Jinja2.exceptions.templatesyntaxerror: Expected Token 'end Of Print Statement', Got 'posted'"