This is a DjangoREST application for managing a library system. It provides CRUD (Create, Read, Update, Delete) operations for books.
- Allows listing all books
- Allows adding a new book
- Supports updating an existing book
- Supports deleting a book
-
Clone the repository:
-
Navigate to the project directory:
-
Create a virtual environment (optional but recommended): python -m venv venv
-
Activate the virtual environment:
-
On Windows: venv\Scripts\activate
-
On macOS and Linux: source venv/bin/activate
-
Install the dependencies: pip install -r requirements.txt
-
Create environment variables using the
env_template
file -
Run migrations to create database tables: python manage.py migrate
-
Run the development server: python manage.py runserver
-
Access the API endpoints in your browser or using tools like Postman:
http://127.0.0.1:8000/api/books/ # Endpoint for adding and listing books http://127.0.0.1:8000/api/books// # Endpoint for updating and deleting a book
POST /api/books/
: Create a new bookGET /api/books/
: Retrieve all booksPUT /api/books/<id>/
: Update book by IDGET /api/books/<id>/
: Retrieve a book by ID- DELETE /api/books//`: Delete book by ID
- Django
- Django REST Framework (DRF)
- SQLite: Database system used for development
Unit tests have been included to verify the functionality of the application. To run the tests, execute the following command:
python manage.py test