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 with SQLAlchemy Basics Creating a Basic Website with Flask Create a Flask App

What's wrong with my view (app.route) . I don't understand why it isn't running the third task properly. Thanks!

Please help

app.py
from flask import Flask
app = Flask(__name__)

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

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=8000)

1 Answer

Hi Luis!

The tester for that challenge is just too particular (kind of a 'biatch, in my book LOL)!?!

I had to do boatload of trial-n- error to get it right!

The "Bummer" hints are not very helpful in this challenge.

Sometimes I have NO IDEA what the challenge is asking for until I get it right or look up the answer somewhere else (or consult the forums, like you did).

Syntax is generally so arbitrary that I can't understand much of it without seeing several correct/exact examples.

Without many great/accurate examples, many tutorials are useless. A lot leave out critical details without which you can't code it correctly. For example, I took the OWASP course, which was good. but it's missing a lot of critical details about how to implement it - they show a lot of code samples, but not where it goes. (On the client? On the server? In which file? Do I have to do it? Or do I have to involve my hosting provider's tech support, etc.?!? It can get very frustrating.) Unfortunately, I usually have to consult copious 3rd-part resources to fully grasp much of the material.

This passes all three:

from flask import Flask

app = Flask(__name__)


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


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8000) 

The double spacing between lines helped as did not putting dunder name in quotes!?!

Like this (you had it right):

__name__ instead of '__name__'

I also got rid of "debug=True" in the app.run statement.

I hope that helps.

Stay safe and happy coding!

Peter, you're a star! Thanks!