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 Request args

Vanessza Koos
Vanessza Koos
555 Points

Hi, I got this error message: Bummer: '/' gave a non-200 response. Did you change the route? Anybody any idea?

Hi, I got this error message: Bummer: '/' gave a non-200 response. Did you change the route? Anybody any idea what is the problem?

flask_app.py
from flask import Flask
from flask import request

app = Flask(__name__)

@app.route('/')
def index(name):
     return "Hello {}".format(name)

Hi Vanessza. It looks to me like you just looked over something wrong. look at it again Vanessza Koos :P

1 Answer

Or in my opinion it should look something like this

from flask import Flask
from flask import request

app = Flask(__name__)


app.route('/')
def index(name='Christian'):
    name = request.args.get('name', name)
    return 'Hello {}!'.format(name)

Good luck on your python adventure. Hope this helps some :3 Vanessza Koos

Your welcome sorry it took me a while to answer. I'm learning python frameworks myself so if you need help please just ping me i will help Vanessza Koos

Vanessza Koos
Vanessza Koos
555 Points

All right I'll thank you!

Thank you