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 Create a view

Rod Rojas
Rod Rojas
1,436 Points

I feel like I don't recognize the syntax in this code challenge. Have I missed a course?

for example "app = Flask(_name__)" when have we covered this syntax?

how about "render_template" ??

I don't want to have to cheat and look at other people's answers and figure it out that way. I want to be able to have some tools given to me, and then use my own thinking to provide the answers.

from flask import Flask

app = Flask(__name__)

# Your code goes here

2 Answers

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

Using app = Flask(__name__) Is boilerplate code for most Flask apps. This was Was first covered in the First Steps video near ** 1:55**.

For the Create a View you don't need to use render_template

The task is: Add a view function named index. Give this view a route of "/". Make the view return your name. You do not need to use app.run().

This needs only the @app.route decorator on a regular python function. The return value is you name as a string.

Post back if you want more hints.

Rod Rojas
Rod Rojas
1,436 Points

thank you so much Chris, that was very helpful