Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Flask with SQLAlchemy Basics Creating a Basic Website with Flask Create a Flask App

Possible bug?

I keep getting a "Bummer: You should have a dunder main statement at the end of your file." message. I passed step 2, which was to add the dunder main statement. But now when I add the route and index function, it tells me this. I don't think I have anything wrong here. Can anybody spot a mistake?

from flask import Flask

app = Flask(__name__)

def index():
    return 'Hello Flask'

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

1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there, Mat Clark! The only thing I can see that isn't quite right has to do with PEP 8 standards that say that there should be two blank lines after a function definition. So if I add an extra blank line between the return 'Hello Flask' and the "dunder main", the challenge passes.

I'll reach out to the education team to see if this was intended.

Hope this helps! :sparkles:

Chris Freeman
Chris Freeman
Treehouse Moderator 67,893 Points

The challenge does state to follow PEP008 standards. The regex errors from the challenge checker indicate they are looking for double blank lines following the import, following the app statement, and before the if __name__ statement.