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

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.

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