Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> from flask import Flask, url_for
- >>> app = Flask(__name__)
- >>> @app.route('/')
- ... def index(): pass
- ...
- >>> @app.route('/login')
- ... def login(): pass
- ...
- >>> @app.route('/user/<username>')
- ... def profile(username): pass
- ...
- >>> with app.test_request_context():
- ... print url_for('index')
- ... print url_for('login')
- ... print url_for('login', next='/')
- ... print url_for('profile', username='John Doe')
- ...
- # /
- # /login
- # /login?next=/
- # /user/John%20Doe
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement