V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
romanxu
V2EX  ›  Flask

flask url_for 的问题

  •  
  •   romanxu · Nov 4, 2015 · 2950 views
    This topic created in 3832 days ago, the information mentioned may be changed or developed.

    @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 函数时,里面的参数要怎么填?

    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2572 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 06:54 · PVG 14:54 · LAX 23:54 · JFK 02:54
    ♥ Do have faith in what you're doing.