Flask homepage code example
Example 1: python flask
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "Hello world!"
if __name__ == '__main__':
app.debug = True
app.run()
Example 2: html for basic flask home page python
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
return "Hello, World!"
@app.route('/welcome')
def welcome():
return render_template('welcome.html')
if __name__ == '__main__':
app.run(debug=True)
Example 3: Flask
pip install -U Flask
Example 4: flask page
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'