有没有人使用Flask-Security
扩展名进行身份验证?我如何获得注册视图的工作?如何使用Flask-Security注册视图?
http://packages.python.org/Flask-Security/customizing.html
我指的是上面的链接。
@app.route('/register', methods=['GET'])
def register():
return render_template('security/register_user.html')
我不想扩展默认类,我只想在我的网站布局中包装默认注册视图,所以我这样做了。
{% extends "layout.html" %}
{% block title %}upload{% endblock %}
{% block body %}
{% from "security/_macros.html" import render_field_with_errors, render_field %}
{% include "security/_messages.html" %}
<h1>Register</h1>
<form action="{{ url_for_security('register') }}" method="POST" name="register_user_form">
{{ register_user_form.hidden_tag() }}
{{ render_field_with_errors(register_user_form.email) }}
{{ render_field_with_errors(register_user_form.password) }}
{% if register_user_form.password_confirm %}
{{ render_field_with_errors(register_user_form.password_confirm) }}
{% endif %}
{{ render_field(register_user_form.submit) }}
</form>
{% include "security/_menu.html" %}
{% endblock %}
我得到以下错误?
werkzeug.routing.BuildError
BuildError: ('security.register', {}, None)
可能是它的一个错字,当你张贴在这里,但您的视图功能键入为“regsiter”而不是“register”。 – codegeek 2013-02-10 01:04:46
对不起,这只是我写在这里的一个错字.... – 2013-02-10 01:28:58