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_appresponse = self.handle_exception(e)
handle_exceptionreraise(exc_type, exc_value, tb)
reraiseraise value
wsgi_appresponse = self.full_dispatch_request()
full_dispatch_requestrv = self.handle_user_exception(e)
handle_user_exceptionreraise(exc_type, exc_value, tb)
reraiseraise value
full_dispatch_requestrv = self.dispatch_request()
dispatch_requestreturn self.view_functions[rule.endpoint](**req.view_args)
registerreturn render_template('register.html')
render_templatereturn _render(
_renderrv = template.render(context)
renderself.environment.handle_exception()
handle_exceptionreraise(*rewrite_traceback_stack(source=source))
reraiseraise value.with_traceback(tb)
top-level template code{% extends 'base.html' %}
top-level template code{% block layout %}
block "layout"{{ form.csrf_token }}
getattrreturn 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值

祝:学习愉快!
相似问题