romanxu
V2EX  ›  Flask

flask url_for 的问题

  •  
  •   romanxu · Nov 4, 2015 · 2999 views
    This topic created in 3857 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   ·   3262 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 12:01 · PVG 20:01 · LAX 05:01 · JFK 08:01
    ♥ Do have faith in what you're doing.