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

im totaly confused on this one pliz help

n

flask_app.py
from flask import request

app = flask(__name__)

@app.route('/')
def index():
    return 'Hello Tery'

1 Answer

Christopher Shaw
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Shaw
Python Web Development Techdegree Graduate 58,248 Points

You should probably rewatch the video as the challage is basically redoing exactly what was done in the video.

You have replaced Flask with request, where both imorts are required. I have done it in one line here.

In the index method, we now get the name variable from the request args, and then return it with hello.

from flask import Flask, request

app = Flask(__name__)

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