Written by Sümeyye Sever (notes I took while learning Python)
Flask is a micro-framework for web development in Python. It is called a "micro" framework because it keeps the core functionality simple and extensible. Flask is ideal for small to medium-sized applications and provides the flexibility to add components as needed.
Install Flask using pip:
pip install flask
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "Hello World!"
if __name__ == "__main__":
app.run(debug=True)
app = Flask(__name__): Initializes the Flask application.@app.route("/"): Maps the URL / to the home function.app.run(debug=True): Starts the development server with debugging enabled.After runnig the script, application will be accessible at http://127.0.0.1:5000/.