This is a Vendor Management System developed using Django and Django REST Framework. This system handles vendor profiles, tracks purchase orders, and calculates vendor performance metrics.
-
Clone the repository:
git clone https://github.com/navansh03/Vendor-Management-System.git
Locating to the Project Directory:
cd Vendor-Management-System -
Create a virtual environment:
python -m venv env
-
Activate the virtual environment:
- On Windows, run:
.\env\Scripts\activate
- On Unix or MacOS, run:
source env/bin/activate
- On Windows, run:
-
Install the required packages:
pip install -r requirements.txt
-
Build the Docker image:
docker build -t vendor-management-system-django-1 . -
Run the Docker container:
docker run -p 8000:8000 vendor-management-system-django-1:latest
The application should now be running at http://localhost:8000.
To create a user, you can use the Django admin interface. First, run the following command to create a superuser:
cd ManagementSystem
python manage.py createsuperuserTo generate a token, send a POST request to http://localhost:8000/api/token/ with your username and password in the body. Here's an example using curl:
curl -X POST -H "Content-Type: application/json" -d '{"username":"yourusername","password":"yourpassword"}' http://localhost:8000/api/token/Please replace yourusername and yourpassword with your actual username and password which you have created.
You can then use this token in your API requests by including it in the Authorization header, prefixed with Token :
curl -X GET -H "Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b" http://localhost:8000/api/vendors/A Postman collection is included in the project directory to help you interact with the API. This collection contains pre-configured requests for all the API endpoints.
To use the Postman collection:
- Open Postman.
- Click on "File" -> "Import...".
- Choose the
Vendor Management System.postman_collection.jsonfile from the project directory. - After importing, you'll see the collection in the "Collections" tab. You can now use these requests to interact with the API.
All API endpoints are documented in Swagger. After running the application, you can access the Swagger UI at http://localhost:8000/swagger.
The Swagger UI provides a comprehensive list of all API endpoints, along with descriptions and examples for each one. You can also try out the API directly from the Swagger UI.
Then, to run the test suite, execute the following command:
python manage.py testThis will run all the tests in your Django project and display the results in the terminal
If you have any questions or issues, feel free to contact the developer. You can reach me at:
- Email: navanshgoswami4@gmail.com
- GitHub: @navansh03