Luan Fonseca - Multmeio
<luanfonceca@gmail.com>
$ pip install flask
$ mkdir hello_world_flask && vi hello_world_flask/hello_world.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_world():
return "Hello World!"
if __name__ == "__main__":
app.run(debug=True)
# http://localhost:5000
$ python hello_world.py
@app.route("/")
@app.route("/<string:name>/")
def hello_world(name="World"):
return "Hello %s!" % name.title()
# Terminal $ mkdir templates && vi templates/hello_world.html
# app.py from flask import Flask, render_template @app.route("/") @app.route("/<string:name>/") def hello_world(name="World"): return render_template("hello_world.html", name=name.title())
# templates/hello_world.html <html> <body> Hello {{ name }} </body> </html>
$ pip install requests BeautifulSoup