register.html报错
来源:2-1 用户注册页面开发(上)-完成注册流程
晓芳1
2021-02-17 15:03:38
jinja2.exceptions.UndefinedError: 'form' is undefined
__call__
return self.wsgi_app(environ, start_response)
wsgi_app
response = self.handle_exception(e)
handle_exception
reraise(exc_type, exc_value, tb)
reraise
raise value
wsgi_app
response = self.full_dispatch_request()
full_dispatch_request
rv = self.handle_user_exception(e)
handle_user_exception
reraise(exc_type, exc_value, tb)
reraise
raise value
full_dispatch_request
rv = self.dispatch_request()
dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
register
return render_template('register.html')
render_template
return _render(
_render
rv = template.render(context)
render
self.environment.handle_exception()
handle_exception
reraise(*rewrite_traceback_stack(source=source))
reraise
raise value.with_traceback(tb)
top-level template code
{% extends 'base.html' %}
top-level template code
{% block layout %}
block "layout"
{{ form.csrf_token }}
getattr
return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'form' is undefined
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
dump()
shows all variables in the frame
dump(obj)
dumps all that's known about the object
1回答
时间,
2021-02-19
同学,你好!视图函数register在渲染页面时需要传递form值
祝:学习愉快!
相似问题