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 trialIshita .
4,290 PointsHow does a route and its view interact?
What happens exactly after a route is visited? Why is "name" required by the index function as an argument if it is present in the URL already?
1 Answer
Ryan Carson
23,287 Points@app.route('/')
@app.route('/<name>')
def index(name="Treehouse"):
return "Hello from {}".format(name)
The value of name
in the URL is passed to the index function, which is why it's an argument. Simply adding arguments to the URL string doesn't cause the app to act.