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

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.