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
Nandhini Sampath
Courses Plus Student 180 PointsHow to create a workspace to practice Flask basic exercise?
I would like to create an individual workspace to practice Flask-basics. I launched a new workspace with python runtime, however the environment does not contain Flask and if we need to install it, what are the instructions to install it? or my expectation that the launched workspace will have Flask preinstalled correct ?
I am trying to run the following script in the new workspace launched, and am trying to preview I get the following error
Workspace url: https://teamtreehouse.com/workspaces/27820232#
Code to execute/preview:
from flask import Flask from flask import render_template
app = Flask(name)
@app.route('/') def index(): return render_template("index.html")
@app.route('/save', methods=['POST']) def save(): return 'Saved!'
app.run(debug=True, host='0.0.0.0', port=8000)
Use the "eye" icon to preview, it opens up the following url
http://port-8000-gxkoudlulg.treehouse-app.com/
I get the following error:
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
Kenneth Love
Treehouse Guest TeacherDid you run your script before you clicked the eye? python app.py (or similar) in the shell.
Nicholas Gaerlan
9,501 PointsNicholas Gaerlan
9,501 PointsI had the same problem. That's exactly the right solution... Run the script in the shell before trying the preview. I couldn't figure this out.