A comprehensive and user-friendly Library Management System built using Flask and SQLAlchemy. This application allows users to borrow and return books, manage their library inventory, and much more.
- ✨ Features
- 📂 Folder Structure
- ⚙️ Working of Application
- 🚀 How to Run
- 🛠️ Usage
- 📚 Topics Covered
- 🤝 Contributing
- 📜 License
- 👤 User authentication (login/logout)
- 📖 Borrow books
- 🔄 Return books
- 📚 View available and borrowed books
- 🛠️ Manage library inventory
- 💕 Responsive design with Bootstrap.
- 🚫 Error handling for various user actions
library_management_system/
│
├── app.py # Main application file
├── config.py # Configuration file
├── requirements.txt # Python dependencies
├── Dockerfile # for containerization
│
├── library_system/
│ ├── __init__.py # Package initializer
│ ├── book.py # Book model
│ ├── user.py # User model
│ ├── library.py # Library logic
│ └── exceptions.py # Custom exceptions
│
├── static/
│ └── css/ # CSS files
│ └── styles.css # Main stylesheet
│
└── templates/ # HTML templates
├── base.html # Base template
├── index.html # Homepage template
├── login.html # Login page template
├── borrow_book.html # Borrow book template
└── return_book.html # Return book template
- 🔒 User Authentication: Users need to log in to borrow or return books.
- 📖 Borrow Book: Users can borrow books by providing the ISBN and their username. The system checks if the book is available and assigns it to the user.
- 🔄 Return Book: Users can return books by providing the ISBN and their username. The system verifies the user and updates the book's status to available.
- 🛠️ Manage Inventory: Admin can manage the inventory by adding or removing books from the database.
-
Clone the repository:
git clone https://github.com/Liquizar/library_management_system.git cd library_management_system
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
flask run
-
Open your browser and navigate to
http://127.0.0.1:5000
-
Build the Docker image:
docker build -t library_management_system .
-
Run the Docker container:
docker run -d -p 5000:5000 --name library_management_system_container library_management_system
-
Open your browser and go to
http://localhost:5000
.
- 🔒 Login: Use the login form to authenticate.
- 📖 Borrow Book: Navigate to the "Borrow Book" page, enter the ISBN of the book and your username, then submit.
- 🔄 Return Book: Navigate to the "Return Book" page, enter the ISBN of the book and your username, then submit.
- 📚 View Inventory: The home page displays the list of available and borrowed books.
This project covers the following Python topics:
-
Flask Framework
- Setting up routes
- Handling GET and POST requests
- Using Flask templates
- Flash messages for user feedback
- User session management
-
SQLAlchemy
- ORM (Object-Relational Mapping)
- Creating and managing database models
- Database sessions and transactions
-
HTML & CSS
- Structuring web pages with HTML
- Styling web pages with CSS
- Bootstrap for responsive design
-
Python Basics
- Classes and objects
- Error handling with try-except blocks
- List comprehensions
- Dictionary operations
-
Docker for containerization
-
Git for version control
We welcome contributions to improve this Library Management System. To contribute:
- Fork the repository.
- Create a new branch.
- Make your changes.
- Submit a pull request with a detailed description of your changes.
This project is licensed under the MIT License. See the LICENSE file for details.
Made with ❤️ by Amit Yadav