Flask Admin-在url_中传递什么内容(';';)?

Flask Admin-在url_中传递什么内容(';';)?,flask,flask-admin,Flask,Flask Admin,我得到一个错误,就是说,不能从(“”)的URL_中的参数构建URL 我为('admin')传递了url_,但这不起作用。我应该传递什么才能到达localhost:5000/admin 谢谢您传递了要访问的路线定义的名称 例如: @app.route('/') def index(): return 'Hello, World!' ... @app.route('/some_page') def somewhere_else(): if something_happened:

我得到一个错误,就是说,不能从(“”)的URL_中的参数构建URL

我为('admin')传递了url_,但这不起作用。我应该传递什么才能到达localhost:5000/admin


谢谢

您传递了要访问的路线定义的名称

例如:

@app.route('/')
def index():
    return 'Hello, World!'

...

@app.route('/some_page')
def somewhere_else():
    if something_happened:
        redirect(url_for('index'))
    
    return render_template('some_page.html')

或者,如果您在HTML中使用它:

<a href="{{ url_for('index') }} ...></a>

谢谢,我理解这个概念,但它如何适用于/admin路由?flask admin的/admin路径的默认定义是什么?我得到了:url_for('admin.index')到达了索引页面。