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 Character Builder Review: Flask Basics

Flask Basics

Attach the following view to my app with the route of /teachers.

def teachers(): return 'We have lots of teachers!'

im stuck anyone?

2 Answers

Hi Tafadzwa Timothy Gakaka !

Adding a route above a function requires a decorator of @app.route

then inside the parenthesis you need to specify what the route is in the parenthesis.

For example:

@app.route('/')
def index():
    return "This is my home page!"

I suggest reviewing this video :) First Steps

flasking can be tough and the is a lot you have to pay attention too. this code here is what it should look like. Happy coding!

@app.route('/teachers')

def teachers():

return "We have lots of teachers"