Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHasan Ahmad
6,727 PointsI don't understand what the angle brackets do
I don't understand what the angle brackets do to the route
@app.route('/')
@app.route('/<name>')
def index(name='Treehouse'):
return 'hello {}'.format(name)
1 Answer
Wolfgang Warneke
10,845 PointsIt passes the values at their relative positions of the HTTP request as arguments in the associated view function.
@app.route('/shout/<parameter_one>/<parameter_two>')
def shout(parameter_one, parameter_two):
'''prints two strings in all caps'''
return (parameter_one + " " + parameter_two).upper()
Http request: http://addressforyourapp.com/shout/argument1/argument2
Result on page: ARGUMENT1 ARGUMENT2
URL route registrations in the docs for more
Tutorialspoint material about it also
Hope this helps out