This Django project is a simple inventory management system that allows you to manage and query product information. It provides a RESTful API to list products and filter them based on various criteria.
These instructions will help you set up and run the project on your local machine.
- Python 3.x
- pip (Python package manager)
- Clone the repository:
git clone https://github.com/your-username/inventory.git
cd inventory
- Create a virtual environment and activate it:
python3 -m venv venv
source venv/bin/activate # On Windows, use: venv\Scripts\activate
- Install project dependencies:
pip install -r requirements.txt
To start the Django development server, run the following command:
python manage.py runserver
The server will be accessible at http://127.0.0.1:8000/.
Applying Database Migrations Before running the server, apply database migrations to create the database schema:
python manage.py makemigrations
python manage.py migrate
List all products: GET /products/ Filter products by name, category, minimum price, and maximum price: GET /products/?name=&category=&min_price=<min_price>&max_price=<max_price>
To populate the database with sample data, you can use the Django admin interface or create products using the Django shell.