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

502 Bad Gateway?

Everything works until use the decorator and open up the window under port 8000 I get 502 bad gateway. server returned an invalid or incomplete response.

from flask import Flask


#use whatever our current namespace is
#always refer to yourself.
app = Flask(__name__)

#decorator is a function that wraps around another function
#take this function and register it as a route as '/'
@app.route('/')
def index():
  return "hello from treehouse" 

app.run(debug=True, port=8000, host='0.0.0.0')

UPDATE:

Now I'm getting:

Workspace Unavailable This is a preview link for a Treehouse Workspace that is not currently active. If you are the workspace owner, you can launch it again via the Treehouse site.

1 Answer

It seemed like it solved when i exited treehouse, restarted the browser, and switched to chrome.