V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
romanxu
V2EX  ›  Flask

flask url_for 的问题

  •  
  •   romanxu · 2015-11-04 13:02:52 +08:00 · 2283 次点击
    这是一个创建于 3067 天前的主题,其中的信息可能已经有所发展或是发生改变。

    @app.route('/album/<slug>')
    def show_album(slug):
    r= get_root_dirs_files()
    try:
    r = r[slug]
    except:
    return 'Album Not Existing'

    return render_template("albums.html",  dicts=r)
    

    @app.route("/delete/<path:object_name>")
    def delete(object_name):
    obj = storage.get(object_name)
    print obj
    remove('./static/uploads/Pictures/%s' % (obj.name))
    return redirect(url_for('show_album'???))

    delete 函数中, url_for show_album 函数时,里面的参数要怎么填?

    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2021 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 16:17 · PVG 00:17 · LAX 09:17 · JFK 12:17
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.