Skip to content

A simple Flask web application with MySQL for performing basic CRUD (Create, Read, Update, Delete) operations on user data. Includes additional utility features for date display and arithmetic operations.

License

Notifications You must be signed in to change notification settings

lovnishverma/flask-mysql-crud-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

πŸš€ Flask MySQL CRUD App

License: MIT Python Version Flask MySQL


πŸ“„ Project Overview

This is a simple Flask + MySQL CRUD (Create, Read, Update, Delete) Web Application built for learning purposes only. It demonstrates basic CRUD operations on user records using Flask as the web framework and MySQL as the database.

It also includes additional demonstration pages for:

  • Displaying the current date and time
  • Performing a simple addition of two numbers via a form

πŸ› οΈ Tech Stack

Technology Purpose
Python 3.9+ Core Programming Language
Flask 2.3+ Web Framework
MySQL 8.0+ Relational Database
MySQL Connector Python to MySQL Connection
dotenv Secure environment configuration
HTML (Jinja2) Templating for views

🚩 Features

  • βœ… Add new user
  • βœ… View all users
  • βœ… Edit existing user
  • βœ… Delete user
  • βœ… Display current date and time
  • βœ… Simple number addition via form

πŸ“‚ Project Structure

β”œβ”€β”€ app.py                 # Main Flask Application
β”œβ”€β”€ .env                   # Environment variables for MySQL credentials
β”œβ”€β”€ templates/              # HTML Templates (Jinja2)
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ adduser.html
β”‚   β”œβ”€β”€ edituser.html
β”‚   β”œβ”€β”€ date.html
β”‚   β”œβ”€β”€ sum.html
β”œβ”€β”€ requirements.txt        # Python Dependencies
└── README.md               # Project Documentation

πŸš€ Getting Started

πŸ”§ Prerequisites

  • Python 3.9+
  • MySQL Server (Running on localhost:3306)

πŸ”¨ Installation Steps

1️⃣ Clone the Repository

git clone https://github.com/lovnishverma/flask-mysql-crud-app.git
cd flask-mysql-crud-app

2️⃣ Set up Virtual Environment

python -m venv venv
source venv/bin/activate      # On Linux / macOS
venv\Scripts\activate         # On Windows

3️⃣ Install Dependencies

pip install -r requirements.txt

4️⃣ Configure .env for MySQL Credentials

user=your_mysql_username
pass=your_mysql_password

5️⃣ Ensure MySQL is Running

  • Port: 3306
  • Host: localhost
  • User exists with the credentials provided in .env

6️⃣ Run the Application

python app.py

7️⃣ Open in Browser

http://localhost:5000

πŸ’‘ Usage Instructions

URL Purpose
/ List all users
/adduser Form to add user
/edit/<id> Edit specific user
/delete/<id> Delete specific user
/date Show current date
/sumpage Sum numbers via form

πŸ“’ Disclaimer

This project is created strictly for educational purposes only. It is not intended for production usage. Security best practices such as input validation, CSRF protection, authentication, and authorization are not implemented. The database schema is minimal and the project structure is kept simple for easier understanding.


πŸ“„ License

This project is licensed under the MIT License.


πŸ§‘β€πŸ« Acknowledgements


⭐ How to Support

If you found this project useful for learning:

  • ⭐ Star this repository
  • βœ… Fork and experiment further
  • πŸ’¬ Share feedback for improvement

About

A simple Flask web application with MySQL for performing basic CRUD (Create, Read, Update, Delete) operations on user data. Includes additional utility features for date display and arithmetic operations.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published