Table of Contents
The app is publically availabe on github and is also deployed on aws (http://13.235.81.184/admin/). This doucment focuses on setting up the app on local machine.
The app requires python 3.10 or later to run and it can work both on windows and linux.
- windows
https://www.python.org/downloads/windows/
- linux
sudo apt install python3
Follow the steps to setup the app on local machine.
- Open the terminal on linux or powershell on windows
- Clone the repo
git clone https://github.com/arshdoda/fatmug
- Create a virtual env
cd fatmug python3 -m venv .venv
- Activate the virtual env
- windows
.venv/Scripts/activate
- linux
source .venv/bin/activate
- Install Dependencies
pip install -r requirements.txt
- Run the app
cd backend python3 manage.py runserver
This app support Token based authentication and Session based authentication (in local env only). Use the following credentials to login/get token.
- Online URL: 13.127.83.149
- Local URL: 127.0.0.1:8000
- Username: fatmug
- Password: fatmug@123
Then, use curl to call the api's as shown below.
curl -H "Authorization: JWT {access token}" http://13.235.81.184/api/vendors/
To use the endpoint locally, replace "13.127.83.149" with "127.0.0.1:8000"
http://13.235.81.184/api/token/ http://13.235.81.184/api/token/refresh/
- Following apis require a user to be authenticated. You can use both Token and Session base authentication.
http://13.235.81.184/api/vendors/ http://13.235.81.184/api/vendors/{id}/ http://13.235.81.184/api/vendors/{id}/performance/
http://13.235.81.184/api/purchase_orders/ http://13.235.81.184/api/purchase_orders/{id}/ http://13.235.81.184/api/purchase_orders/{id}/performance/
The db.sqlite3 already contains 5 vendors and 100000 PO data. To start from scratch follow the steps
- Delete the db.sqlite3 file from backend.
- Create DB and run migrations
python3 manage.py migrate
- Create superuser
python3 manage.py createsuperuser
Now, you can use the above api's to create the data. If you want to generate data in one go then continue with the following steps
- Modify the dummy_data.py file as required.
- Run Django shell
python3 manage.py shell
- Run Data Creation script
exec(open('dummy_data.py').read())
- Required only if data is generated using script: To calculate the performance matrix for the vendors, authenticate the user with any of the authentication method and then go to the http://127.0.0.1:8000/api/purchase_orders/calculate_matrix