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
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 |
- β Add new user
- β View all users
- β Edit existing user
- β Delete user
- β Display current date and time
- β Simple number addition via form
βββ 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
- Python 3.9+
- MySQL Server (Running on
localhost:3306
)
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
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 |
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.
This project is licensed under the MIT License.
If you found this project useful for learning:
- β Star this repository
- β Fork and experiment further
- π¬ Share feedback for improvement