Menu

Flask Explained: The Small Framework That Does Just Enough
πŸ“°

Flask Explained: The Small Framework That Does Just Enough

DEV Community: flaskΒ·The Practical DeveloperΒ·2 days ago
#e053Nku6
#devtoflask#devto#dev#flask#django
Reading 0:00
15s threshold

Introduction

Django (covered earlier) gives you everything: an ORM, an admin panel, authentication, and a project structure, decided for you. Flask, created by Armin Ronacher in 2010, gives you almost nothing β€” routing, request handling, and a template engine β€” and lets you add the rest yourself. That minimalism is the point: for small apps, APIs, and learning, a framework that stays out of the way teaches you more than one that does everything.

A complete app in a few lines

Flask's famous "hello world" is a whole working web app:

from flask import Flask

app = Flask ( __name__ )

@app.route ( " / " ) def home (): return " Hello, Flask! "

@app.route ( " /users/<name> " ) def greet ( name ): return f " Hello, { name } ! "

Enter fullscreen mode

Exit fullscreen mode

The @app.route decorator maps a URL to a function, <name> captures part of the URL as a variable, and returning a string sends it as the response.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.