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

Python Flask Basics Welcome to Flask View Args Through URL

Sai Kiran Dasika
PLUS
Sai Kiran Dasika
Courses Plus Student 7,278 Points

What's wrong in this ?

I think that this code is perfectly fine. But its giving me an error.

flask_app.py
from flask import Flask

app = Flask(__name__)


@app.route('/<name>')
def hello(name):
     return 'Hello {}'.format(name)

1 Answer

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hello Sai.

i presume you are stuck at 3/3 part.

The problem is that in task 1/3 you did not add a route, but you modified the ('/') route. I would suggest you add that initial route again and then set the name equal to "Treehouse" (this is the procedure to have it set to "Treehouse" as default value).

I hope this makes it clear.

Vittorio