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 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.)