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

Hi could you please help me fix this error i am getting - Make sure to place your route after your app variable.

Please help me understand what i'm doing wrong with this code.

from flask import Flask

app = Flask(__name__)
def index():
    return 'Hello Flask'

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

1 Answer

Megan Amendola
.a{fill-rule:evenodd;}techdegree seal-36
Megan Amendola
Treehouse Teacher

Don't forget your Pep8 :) Functions should have 2 empty lines before and after them, so you need 2 empty lines between your app variable and the @app.route