python - jinja: TemplateSyntaxError: expected token 'name', got 'string' -
have 2 files in flask application:
base.html
<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" href="../static/main.css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/css/bootstrap.min.css"> <title>title</title> </head> <body> <div id="content"> {% marker "content" %} </div> </body> </html>
upload.html
, extends base.html
{% extends "base.html" %} {% block "content " %} <title>upload new file</title> <h1>upload new file</h1> <form action="" method=post enctype=multipart/form-data> <p><input type=file name=file> <input type=submit value=upload> </form> {% endblock %}
i'm calling latter in view: return render_template('upload.html' )
, , i'm getting error:
jinja2.exceptions.templatesyntaxerror templatesyntaxerror: expected token 'name', got 'string'
the issue {% block "content" %}
should {% block content %}
- block's name should not quoted.
in addition marker
construct in layout.html not valid jinja2 tag - should {% block content %}{% endblock %}
.
Comments
Post a Comment