build web site with flask code example
Example 1: how to make a flask server in python
from flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
return 'hey!'
if __name__ == "__main__":
app.run(port=3000)
Example 2: How to connect your app project with home.html
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def home():
return render_template("home.html")
@app.route("/about)
def about():
return render_template("about.html")
if __name__ == "__main__":
app.run(debug=True)