Skip to content

πŸ“– A hands-on Flask learning journey β€” from basics to building real-world web apps. 🧠 Ideal for understanding routes, templates , MVC and more β€” with step-by-step examples. ✨ Documented with clarity and created while learning Flask from scratch!

Notifications You must be signed in to change notification settings

Madhav-P-2005/Code-With-Flask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

36 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“˜ Introduction to Flask β€” A Complete Beginner’s Guide

A clean, minimal, and hands-on learning journey into Flask, the lightweight and flexible Python web framework. This repository mirrors a real-world development setup β€” from environment to project organization β€” for building scalable Flask apps step by step.


πŸš€ What is Flask?

Flask is a micro web framework for Python.

  • Lightweight and minimal
  • Flexible structure β€” you define your architecture
  • Easy to learn and perfect for beginners
  • Extensible with a rich ecosystem of third-party tools

βš”οΈ Flask vs Django β€” What's the Difference?

Feature Flask Django
Design Micro-framework (minimal core) Full-stack framework
Structure Developer-defined (flexible) Convention-based (pre-defined)
Admin UI Not included by default Built-in admin panel
Best For APIs, small apps, rapid prototyping Large-scale feature-rich apps
Learning Curve Simple & beginner-friendly Steeper but comprehensive

πŸ› οΈ Project Setup

πŸ“ Step 1: Create Project Directory

mkdir Flask-Learning && cd Flask-Learning\app

🐍 Step 2: Create and Activate Virtual Environment

python -m venv MyEnvironment

βœ… Activate (PowerShell)

.\MyEnvironment\Scripts\Activate.ps1

or

.\Flask-Learning\MyEnvironment\Scripts\Activate.ps1

To deactivate:

deactivate

πŸ“¦ Step 3: Install Flask Inside Virtual Environment

pip install flask

πŸ“‚ Project Structure

Flask-Learning/
β”‚
β”œβ”€β”€ app/                                # Core application folder
β”‚   β”œβ”€β”€ app.py                          # Entry point that initializes and runs the Flask app
β”‚
β”‚   β”œβ”€β”€ controllers/                    # Handles route logic using Blueprints (modular routing)
β”‚   β”‚   └── welcome_controller.py       # Blueprint for handling the '/' route (e.g., Welcome page)
β”‚
β”‚   β”œβ”€β”€ services/                       # Business logic abstraction layer
β”‚   β”‚   └── welcome_service.py          # Contains logic for managing and returning welcome-related data
β”‚
β”‚   └── templates/                      # Jinja2 templates for rendering dynamic HTML content
β”‚       └── Welcome.html                # Template that uses variables (e.g., name, names list)
β”‚
β”œβ”€β”€ MyEnvironment/                      # Virtual environment 
β”œβ”€β”€ .gitignore                          # Excludes virtual environment and cache/temp files
└── Readme.md                           # Project documentation and learning progress

▢️ How to Run the Flask Server

Once you're inside the virtual environment and at the root of your project:

python app.py

By default, Flask will run on:

http://127.0.0.1:5000

If you've set a custom host and port (like 0.0.0.0:3000), Flask will reflect that in the terminal when the server starts.


πŸ“š Topics Covered

  1. Setting up Flask with a virtual environment
  2. Installing and configuring Flask
  3. Rendering static and dynamic content using Jinja2 templates
  4. Structuring Flask apps cleanly with folders like templates/, controllers/, and services/
  5. Using Blueprints to modularize routes
  6. Creating a Service Layer to manage business logic separately
  7. Sending data (variables, lists) from Python to HTML

πŸ”— What’s Next?

  1. This marks the end of the Flask learning phase..
  2. 🧠 Now continuing the journey by building a real-world >ToDo App using Flask.. πŸ‘‰ Follow my next repo here ➜ Flask-ToDo-App (https://github.com/Madhav-P-2005/Flask-ToDo-App.git)

πŸ“š References


Happy Coding πŸ§ͺ✨

About

πŸ“– A hands-on Flask learning journey β€” from basics to building real-world web apps. 🧠 Ideal for understanding routes, templates , MVC and more β€” with step-by-step examples. ✨ Documented with clarity and created while learning Flask from scratch!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published