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 Basics Templates and Static Files Flat HTML

i have lost all of the code can someone pls give the code i nedded pls

i accidently lost all the code i don't know how to getr it back

Carlos Mota
Carlos Mota
2,596 Points

Are you on PC or Mac? If you're on PC then right click the folder and go to folder history tab, and hopefully, it saved it there, there are a lot of other ways to be able to recover files. That's just a simple way.

nakalkucing
nakalkucing
12,964 Points

Hi Millie Jack! Here is the code from file simple_app.py

from flask import Flask

app = Flask(__name__)


@app.route('/')
@app.route('/<name>')
def index(name="Treehouse"):
    return "Hello from {}".format(name)


@app.route('/add/<int:num1>/<int:num2>')
@app.route('/add/<float:num1>/<float:num2>')
@app.route('/add/<int:num1>/<float:num2>')
@app.route('/add/<float:num1>/<int:num2>')
def add(num1, num2):
    return '{} + {} = {}'.format(num1, num2, num1+num2)

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

Hope this helps!

1 Answer

You can simply launch a new workspace from the current video you're watching (or if you are working on a local machine, you can launch a workspace then download the files.)