我想抛出用户在填写表格时所犯的所有错误。
我尝试在此处四处插入逗号,但似乎没有任何作用
错误
Traceback (most recent call last):
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/flask/app.py", line 2463, in __call__
return self.wsgi_app(environ, start_response)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/flask/app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/flask/app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/bhuvan/Documents/seriously_portfolio/app.py", line 14, in index
return render_template("index.html", form=form)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/flask/templating.py", line 140, in render_template
ctx.app,
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/flask/templating.py", line 120, in _render
rv = template.render(context)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/home/bhuvan/Documents/seriously_portfolio/templates/form.html", line 39, in template
<div class="invalid-feedback">
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/environment.py", line 1005, in render
return concat(self.root_render_func(self.new_context(vars)))
File "/home/bhuvan/Documents/seriously_portfolio/templates/index.html", line 3, in top-level template code
{% extends 'layout.html' %}
File "/home/bhuvan/Documents/seriously_portfolio/templates/layout.html", line 21, in top-level template code
{% block content %}
File "/home/bhuvan/Documents/seriously_portfolio/templates/index.html", line 115, in block "content"
{% include 'form.html' %}
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/home/bhuvan/Documents/seriously_portfolio/templates/form.html", line 39, in template
<div class="invalid-feedback">
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/environment.py", line 497, in _parse
return Parser(self, source, name, encode_filename(filename)).parse()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 901, in parse
result = nodes.Template(self.subparse(), lineno=1)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 883, in subparse
rv = self.parse_statement()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 130, in parse_statement
return getattr(self, 'parse_' + self.stream.current.value)()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 213, in parse_if
'name:endif'))
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 165, in parse_statements
result = self.subparse(end_tokens)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 875, in subparse
add_data(self.parse_tuple(with_condexpr=True))
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 620, in parse_tuple
args.append(parse())
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 432, in parse_expression
return self.parse_condexpr()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 437, in parse_condexpr
expr1 = self.parse_or()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 450, in parse_or
left = self.parse_and()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 459, in parse_and
left = self.parse_not()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 470, in parse_not
return self.parse_compare()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 474, in parse_compare
expr = self.parse_math1()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 496, in parse_math1
left = self.parse_concat()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 507, in parse_concat
args = [self.parse_math2()]
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 517, in parse_math2
left = self.parse_pow()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 528, in parse_pow
left = self.parse_unary()
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 547, in parse_unary
node = self.parse_postfix(node)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 676, in parse_postfix
node = self.parse_call(node)
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/parser.py", line 767, in parse_call
self.stream.expect('comma')
File "/home/bhuvan/Documents/seriously_portfolio/env/lib/python3.6/site-packages/jinja2/lexer.py", line 384, in expect
self.name, self.filename)
jinja2.exceptions.TemplateSyntaxError: expected token ',', got 'invalid'
'''
form.html
<form method="POST" action="">
{{ form.hidden_tag() }}
<div class="form-group">
{{ form.name.label() }}
{% if form.name.errors %}
{{ form.name(class="form-control is-invalid") }}
<div class="invalid-feedback">
{% for error in form.name.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.name(class="form-control") }}
<!-- <small class="form-text text-muted">
Enter Characters between 5-20.
</small> -->
{% endif %}
</div>
<div class="form-group">
{{ form.email.label() }}
{% if form.email.errors %}
{{ form.email(class="form-control is-invalid") }}
<div class="invalid-feedback">
{% for error in form.email.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.email(class="form-control") }}
{% endif %}
</div>
<div class="form-group">
{{ form.message.label() }}
<!-- {{ form.message(class="form-control", rows="4", cols="50", placeholder="Enter your message...") }} -->
{% if form.message.errors %}
{{ form.message(class="form-control is-invalid) }}
<div class="invalid-feedback">
{% for error in form.message.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.message(class="form-control") }}
<!-- <small class="form-text text-muted">
Optional. Max Characters 300 only.
</small> -->
{% endif %}
</div>
<div class="form-group">
{{ form.submit(class="btn btn-outline-info")}}
</div>
</form>
编辑:我只是在写随机的东西来提交帖子。请忽略这件事。不,它仍然不会提交帮助该死的。
答案 0 :(得分:1)
您缺少结尾"
:
{{ form.message(class="form-control is-invalid) }}