This is a simple Flask-based web application for managing employee records. It implements CRUD (Create, Read, Update, Delete) operations to allow users to add, view, edit, and delete employee information.
- Create: Add new employees with their name, email, and phone number.
- Read: View a list of all employees in a table format.
- Update: Edit existing employee details.
- Delete: Remove employees from the database.
- Flash Messages: Success messages are displayed after adding, updating, or deleting an employee.
- Bootstrap Styling: The application uses Bootstrap for a clean and responsive user interface.
- Python: The programming language used for the backend.
- Flask: A lightweight web framework for Python.
- SQLite: A lightweight database for storing employee records.
- SQLAlchemy: An ORM (Object-Relational Mapping) tool for database operations.
- Bootstrap: A front-end framework for styling the application.
- JQuery: A JavaScript library for client-side scripting.
Before running the application, ensure you have the following installed:
- Python 3.x
- Pip (Python package installer)
-
Clone the Repository:
git clone https://github.com/your-username/flask-crud-employee-management.git cd flask-crud-employee-management -
Create a Virtual Environment (Optional but recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
If you don't have a
requirements.txtfile, install the required packages manually:pip install Flask Flask-SQLAlchemy
-
Run the Application:
python app.py
-
Access the Application: Open your browser and go to
http://localhost:5000.
flask-crud-employee-management/
├── app.py # Main Flask application file
├── templates/ # HTML templates
│ ├── base.html # Base template
│ ├── index.html # Homepage with employee list
│ ├── add_employee.html # Form for adding new employees
│ ├── edit_employee.html # Form for editing employees
│ ├── delete_employee.html# Confirmation page for deletion
│ └── header.html # Header section
├── static/ # Static files (CSS, JS)
│ ├── css/
│ │ └── bootstrap.min.css
│ └── js/
│ ├── bootstrap.min.js
│ └── jquery-3.5.1.min.js
└── README.md # Project documentation
-
Homepage:
- Displays a list of all employees.
- Click the "Add New Employee" button to add a new employee.
-
Add Employee:
- Fill out the form with the employee's name, email, and phone number.
- Click "Add Employee" to save the record.
-
Edit Employee:
- Click the "Edit" button next to an employee in the list.
- Update the employee's details in the form and click "Update Employee".
-
Delete Employee:
- Click the "Delete" button next to an employee in the list.
- Confirm the deletion when prompted.