What is Flask
Flask is a small and lightweight Python web framework that provides useful tools and features that make creating web applications in Python.
- Flask provides tools, libraries, and technologies for building web applications
- Flask integrates with databases to allow developers to store and access data
- Flask provides templating features to help developers design their applications
- Flask provides routing features to help developers design their applications
Basic example
Install Flask:
1. python -m pip install requests
2. python -m pip install flask==2.3.2
3. python -m pip install flask-mysql
4. python -m pip install flask_cors
5. python -m pip install flask_httpauth
6. python -m pip install cryptography
Run a python app:
from flask import Flask
app = Flask(__name__)
@app.route('/hello/')
def hello_world():
return '<h1>Hello World</h1>'
app.run(host='localhost', port=3001)