The Django API Tech Store is a project built using Django.
It is a RESTful API that enables users to interact with the store in different ways based on their roles : Customers, Vendor and store Manager.
-
- Can view product listings and retrieve essential product details, such as name, category, description, and price.
-
- Have access to product details along with additional information like SKU, stock quantity, and the ability to view inactive products.
-
- Has full access to all product information, including managing product data and stock.
-
- Vendor can place orders for products and view their own orders.
- The Manager has visibility over all orders.
-
- Both Vendor and the Manager can create new products.
-
- The list of out-of-stock products is reserved exclusively for the store team.
-
- Users can filter product listings using various criteria like name, category, and SKU. Custom filters can be added, and pagination is enabled to avoid excessive data loading.
-
Clone the Repository:
git clone https://github.com/sundayz-hunter/DjangoREST-TechStore
-
Install Dependencies:
pip install -r requirements.txt
-
Environement file:
- Rename
.env-distto.envwithout making any modifications to use the basic SQLite3 database, or adapt it according to your specific database information.
- Database Setup:
python manage.py makemigrations python manage.py migrate
- Populate Database:
python manage.py populate_db
- Start Server:
python manage.py runserver
- Two users are automatically created when populating the database:
manager:manager
vendor:vendor
Customers have access to the public API to view products in stock at the store.
-
For simplicity, authentication is handled via sessions when using this project through a browser.
For Manager and Vendor you can login on home page (http://127.0.0.1:8000/) or use admin page (http://127.0.0.1:8000/admin/login/) -
Alternatively, you can use token authentication if you prefer using Postman or any other API client.
Token expiration hasn’t been implemented for ease of use.
In a real production environment, it’s recommended to use JWT for authentication.
- Do a POST request with the Manager or Vendor creds at : http://127.0.0.1:8000/api/v1/auth/get-token
The original token authentication method of Django has been customized to pass a standard header in your requests like :
Authorization: Bearer b3b80815206a81fae18f50a8e26ecc95c1b46dd8
- Swagger: http://127.0.0.1:8000/api/schema/swagger-ui
- Redoc: http://127.0.0.1:8000/api/schema/redoc
- Postman Collection: json Postman collection file is available (api-v1.postman_collection.json)
- Django Silk provides performance monitoring and profiling for your Django application, helping to analyze database queries and measure application performance.
- Find it at : http://127.0.0.1:8000/silk/
