A simple API for managing a product inventory built using Django REST Framework.
- List all products
- Add a new product
- Update a product
- Delete a product
- Bonus: Validation to ensure the product price is non-negative
- Python 3.9+
- Django 4.x
- Django REST Framework 3.x
-
Clone the repository:
git clone https://github.com/yourusername/product-inventory-api.git
-
Create a virtual environment: Run the following command to create a virtual environment:
python3 -m venv env
Activate the virtual environment: On Linux/macOS:
source env/bin/activate
On Windows:
.\env\Scripts\activate
-
Install project dependencies: Run the following command to install all required dependencies:
pip install -r requirements.txt
-
Apply database migrations: Run the following command to apply migrations and set up the database:
python manage.py makemigrations
python manage.py migrate
- Run the development server:
Start the server using the following command:
python manage.py runserver