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 trial
zhulin peng
4,472 Pointswhat is @app.route('/') doing?
hi, as Ken said, def index(): return 'hello tree house'
is just a function, not a view yet. what makes it a view is a route, and the forward '/' i guess it will give a '/' to the end of web address as shown in video?
so I'm thinking why adding a '/' in the end will make a invalid webpage valid? thx
1 Answer
Chris Freeman
Treehouse Moderator 68,468 PointsWhen a request is submitted to the flask server, the requested URL is compared to the paths registered using the @app.route() decorator.
The forward slash ("/") represents the "web root address". If there is no the content after the domain name and optional port number, for example, a local server URL http://127.0.0.1:8000 would be directed to the above route.