Python Web Dev · Flask Beginner Guide
Flask Tutorial for Beginners: Where to Begin in 2026
Quick summary — Flask tutorial for beginners
Flask is one of the simplest and most flexible Python web frameworks to start with. This guide walks you through every step in 2026 — from installing Flask to deploying a real API — with a 90-day roadmap you can actually follow.
In this guide you will learn:
- What Flask is — and why beginners love it.
- How to install Flask — and set up your first project.
- Routes and views — the foundation of any Flask app.
- Templates and forms — for real user interfaces.
- Databases with SQLAlchemy — saving and reading data.
- APIs and deployment — shipping a real project.
SECTION 01What Is Flask?
Flask is a lightweight Python web framework that lets you build web apps and APIs with minimal setup. Unlike bigger frameworks, Flask stays out of your way — which is why it is one of the best choices for beginners.
| Question | Flask |
|---|---|
| Type | Micro web framework for Python |
| Language | Python |
| Used for | Web apps, REST APIs, dashboards, internal tools |
| Popular extensions | Flask-SQLAlchemy, Flask-WTF, Flask-Login, Flask-RESTful |
| Good for | Beginners, prototypes, small-to-medium apps |
SECTION 02Install Flask & Your First App
Getting started with Flask takes just a few minutes. Here is the standard setup every beginner should follow:
| Step | Command | Why It Matters |
|---|---|---|
| 1. Create folder | mkdir myapp && cd myapp |
Keeps your project clean |
| 2. Create virtualenv | python -m venv venv |
Isolates dependencies |
| 3. Activate | source venv/bin/activate |
Uses the isolated Python |
| 4. Install Flask | pip install flask |
Adds Flask to your project |
| 5. Create app.py | Write the first app (see below) | Your entry point |
| 6. Run server | flask run |
Starts development server |
# app.py — your first Flask app
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "Hello, Flask!"
@app.route("/about")
def about():
return "This is the about page."
if __name__ == "__main__":
app.run(debug=True)
Week 1 Review:
□ Is my virtual environment active?
□ Is Flask installed correctly?
□ Does the home route return a string?
□ Is the dev server running?
Week 2 Review:
□ Can I add new routes easily?
□ Do I understand URL parameters?
□ Have I created an /about page?
Week 3 Review:
□ Do I understand the difference between
a view and a route?
□ Can I return HTML from a view?
□ Do I know how to stop and restart the server?
Week 4 Review:
□ Have I committed my project to Git?
□ Do I have a README?
□ Do I feel ready for templates?
SECTION 03Routes, Templates & Forms
Once you can return plain text, the next step is returning real HTML pages with dynamic data. This is where Flask and Jinja2 shine:
| Concept | What You Learn | Example |
|---|---|---|
| Routes | URLs map to Python functions | /products → list_products() |
| URL parameters | Dynamic parts in a URL | /user/<name> |
| Templates | HTML with placeholders | render_template("home.html") |
| Template inheritance | Reusable base layout | {% extends "base.html" %} |
| Forms | Handle GET/POST input | request.form["name"] |
| Flash messages | Show errors or success | flash("Saved!") |
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/")
def home():
return render_template("home.html", name="Beginner")
@app.route("/greet", methods=["POST"])
def greet():
username = request.form.get("username")
return render_template("home.html", name=username)
<!-- templates/base.html -->
<!DOCTYPE html>
<html>
<head>
<title>{% block title %}My App{% endblock %}</title>
</head>
<body>
<nav>
<a href="/">Home</a>
</nav>
<main>
{% block content %}{% endblock %}
</main>
</body>
</html>
<!-- templates/home.html -->
{% extends "base.html" %}
{% block title %}Welcome{% endblock %}
{% block content %}
<h1>Hello, {{ name }}!</h1>
<form method="POST" action="/greet">
<input name="username" placeholder="Your name" />
<button type="submit">Greet me</button>
</form>
{% endblock %}
SECTION 04Databases, APIs & Deployment
Real apps store data. Here is how Flask connects to a database and serves JSON for APIs and frontends:
| Area | What You Learn | Tool |
|---|---|---|
| ORM | Map Python classes to database tables | Flask-SQLAlchemy |
| CRUD | Create, read, update, delete records | SQLAlchemy session |
| Migrations | Update database schema safely | Flask-Migrate |
| JSON APIs | Return data as JSON | jsonify |
| REST | Design predictable endpoints | Flask-RESTful or manual |
| Deploy | Run in production | Gunicorn + Render/Railway |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///app.db"
db = SQLAlchemy(app)
class Note(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(120), nullable=False)
body = db.Column(db.Text)
with app.app_context():
db.create_all()
from flask import jsonify, request
from app import app, db, Note
@app.route("/api/notes", methods=["GET"])
def list_notes():
notes = Note.query.all()
return jsonify([
{"id": n.id, "title": n.title, "body": n.body}
for n in notes
])
@app.route("/api/notes", methods=["POST"])
def create_note():
data = request.get_json()
note = Note(title=data["title"], body=data.get("body", ""))
db.session.add(note)
db.session.commit()
return jsonify({"id": note.id}), 201
SECTION 0590-Day Learning Plan & Templates
Here's a realistic 90-day plan to go from complete beginner to a working Flask project.
Month 1 — Basics:
Week 1 — Install Flask, first "Hello World"
Week 2 — Routes, URL parameters, methods
Week 3 — Jinja2 templates & inheritance
Week 4 — Forms and flash messages
Daily routine:
9:00 AM — Learn concepts (1 hour)
11:00 AM — Hands-on coding (2 hours)
2:00 PM — Read docs (30 min)
5:00 PM — Notes + reflection (30 min)
Milestones:
□ Flask installed and running
□ First app deployed locally
□ Can add routes and templates
Month 2 — Projects:
Week 5 — Flask + SQLAlchemy (CRUD)
Week 6 — User authentication basics
Week 7 — JSON APIs with jsonify
Week 8 — Deploy to Render or Railway
Daily routine:
9:00 AM — Concept (1 hour)
11:00 AM — Hands-on build (2-3 hours)
3:00 PM — Debug and test (1 hour)
5:00 PM — Documentation (30 min)
Milestones:
□ Working CRUD app
□ Login and protected routes
□ Deployed live URL
Month 3 — Portfolio & Interviews:
Week 9 — Capstone project (full app)
Week 10 — Clean up code + README
Week 11 — Interview prep and mock sessions
Week 12 — Apply to Flask/Python roles
Daily routine:
9:00 AM — Project work (2 hours)
11:00 AM — Interview practice (1 hour)
2:00 PM — Applications (1 hour)
5:00 PM — Review and notes (1 hour)
Milestones:
□ Capstone deployed and on GitHub
□ Clean README with screenshots
□ 30+ applications sent
Use these templates to track your daily, weekly, and monthly progress:
Daily Tracker:
Date: _________
☐ Morning routine completed
☐ Learning (1 hour)
☐ Hands-on coding (2 hours)
☐ Read Flask docs (30 min)
☐ Notes + reflection (30 min)
☐ Exercise completed
☐ Reviewed progress
☐ Planned tomorrow
Today's Accomplishments:
1.
2.
3.
Tomorrow's Priorities:
1.
2.
3.
Weekly Tracker:
Week: _____ (Month 1 / 2 / 3)
Goals for this week:
1.
2.
3.
Daily Progress:
Mon: ☐☐☐
Tue: ☐☐☐
Wed: ☐☐☐
Thu: ☐☐☐
Fri: ☐☐☐
Sat: ☐☐☐
Sun: ☐☐☐
Weekly Wins:
1.
2.
3.
Challenges & Solutions:
1.
2.
Next Week's Goals:
1.
2.
3.
Monthly Tracker:
Month: _____ (1 / 2 / 3)
Monthly Goal:
_______________________________________________
Week 1 Progress: ☐☐☐
Week 2 Progress: ☐☐☐
Week 3 Progress: ☐☐☐
Week 4 Progress: ☐☐☐
Monthly Wins:
1.
2.
3.
Skills Gained:
1.
2.
3.
Projects Completed:
1.
2.
3.
Applications Sent: _____
Interviews: _____
Offers: _____
Next Month's Goal:
_______________________________________________
SECTION 06Interview Q&A — Flask for Beginners
Q1Is Flask a good first web framework?
Yes. Flask is one of the best first frameworks because it is small, well-documented, and lets you see how a web app actually works without too much magic.
Q2What is the difference between Flask and Django?
Flask is a micro framework — you add what you need. Django is a full-featured framework with an admin, ORM, auth, and many built-in tools. Flask is easier to start; Django is faster for large apps with many standard features.
Q3Do I need to know HTML to use Flask?
Basic HTML helps a lot — Flask templates produce HTML. You don't need to be an expert, but knowing structure and forms is essential.
Q4What should I build first in Flask?
A small task manager or notes app with a database. It teaches routes, templates, forms, and CRUD in one project.
Q5How do I deploy a Flask app?
Use a production server like Gunicorn, and deploy to platforms like Render, Railway, or a Linux server. For learning, Render and Railway offer free tiers.
SECTION 07Test yourself — Flask Quiz
Five questions. No sign-up.
0 / 5Pick an answer to see why it is right or wrong.
SECTION 08Frequently asked questions
What is Flask, in one sentence?
Flask is a lightweight Python web framework for building web apps and APIs with minimal setup.
How long does it take to learn Flask?
You can build a working Flask app in a day. To become job-ready, expect 3-6 months of consistent practice with real projects.
Do I need to know Python before Flask?
Yes. You should be comfortable with Python basics — functions, loops, and files. Everything else you can learn as you build.
Is Flask still relevant in 2026?
Very much so. Flask is widely used for web apps, internal tools, and APIs. It remains one of the top Python frameworks for beginners and startups.
What should my first Flask project be?
A small notes app or a task manager. It teaches routes, templates, forms, and a database in a single small project.
SECTION 09Related reads
Classroom & online · Noida
Start your Flask journey with Uncodemy
Our Data Analytics Training Course is designed to help you build real Python and web skills — with projects, mentorship, and interview prep that get you hired.
₹15,500 · full programme- Complete 90-day roadmap
- Skills & projects
- Mock interviews
- Weekday & weekend batches