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 Basics Welcome to Flask First Steps

I can't see my code in the browser: workspace unavailable?

I tried to run my first Flask code in the browser but this message appeared:

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.

What is happening? This is my code:

from flask import Flask

app = Flask(__name__)


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

app.run(debug=True, port=8000, host:'0.0.0.0')
Chris Freeman
Chris Freeman
Treehouse Moderator 68,457 Points

Sometimes helps to try a different port such as 8080 instead of 8000.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,457 Points

What command was used in the console window to launch the flask server app? Can you post the console output?

1 Answer

I solved the problem, it was for not writing the name of the file on the terminal.

Joseph Martin Nograles
Joseph Martin Nograles
4,696 Points

I have this same problem. How did you fix it?

Anders Axelsen
Anders Axelsen
3,471 Points

Joseph Martin Nograles, in console, type python + the name of your project.py.

My command is:

python simple_app.py

This sends the new information and the new code to the door.