In Module 13, we explore how Python powers the internet. Python is a top choice for back-end development because of its security, scalability, and the speed at which you can go from an idea to a live website.
A web framework is a collection of tools and libraries that handle the “boring” parts of web development (like handling database connections or routing URLs) so you can focus on building your app.
Flask is a minimalist “micro” framework. It is easy to learn and gives you total control over which components to use.
Example:
Python
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "Welcome to my Flask Site!"
if __name__ == "__main__":
app.run()
Django is a high-level framework that encourages rapid development. It comes with a built-in admin panel, database ORM, and user authentication out of the box. It follows the MVT (Model-View-Template) architecture.
A REST API (Representational State Transfer) is a way for two computers to talk to each other over the web. It uses standard HTTP methods:
FastAPI is a modern framework designed for building APIs. It is incredibly fast (approaching Go and Node.js speeds) and automatically generates interactive documentation (Swagger UI) for your API.
Example:
Python
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello from FastAPI"}
Postman is a popular tool used to test APIs without having to build a front-end website. Developers use it to send requests to their Python servers and check if the JSON responses are correct.