We can build complex web applications using Python. For that, we would need one of the third party Python web framework Flask.
e:\python>pip install flask
# flask
#web2.py
from flask import Flask
app=Flask(__name__)
@app.route("/")
def hello():
return "Hello Chennai"
e:\python>set FLASK_APP=web2.py
to run the app server
e:\python>flask run
open browser and goto
http://127.0.0.1:5000/
Another example
#web4.py
from flask import Flask , render_template
app= Flask(__name__)
@app.route("/")
@app.route("/home")
def home():
return render_template('home.html')
@app.route("/about")
def about():
return render_template('about.html')
@app.route("/home2")
def home2():
return render_template('home2.html')
@app.route("/isdeep")
def isdeep():
return render_template('isdeep.html')
if __name__ == '__main__':
app.debug=True
app.run