This project provides a simple API for managing bank loans using Django and Django Rest Framework. It supports operations such as creating a loan, retrieving loan details, and calculating the total loan amount with interest.
- Create a loan
- Retrieve loan details by loan ID
- Calculate total amount to be paid with interest
- Admin authentication using Django's superuser
- Full test coverage for all routes
- Python 3.12
- Django 5.0
- Django Rest Framework
- PostgreSQL
- Pytest and unittest for testing
-
Clone the repository:
git clone https://github.com/your-username/banking-loan-api.git cd banking-loan-api
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Apply migrations:
python manage.py migrate
-
Create a superuser:
python manage.py createsuperuser
-
Run the server:
python manage.py runserver
pytest
or using Django test runner:
python manage.py test
banking/
├── api/ # Application code
│ ├── views.py # API views
│ ├── services.py # Business logic
│ ├── models.py # Database models
│ └── tests/ # Unit tests
├── settings.py # Django project settings
├── urls.py # URL routing
└── manage.py