/Fatmug

Primary LanguagePython

Fatmug

Vendor management Assignment

Setup steps

  1. Clone this repository on your local machine
  2. Go inside the Fatmug directory
  3. Install django using pip install django (Make sure python is installed on your system)
  4. We are using rest_framework, so use pip install djangorestframework to use it.
  5. Use the command python manage.py migrate which will create required tables in your database.
  6. For token based authentication, we have to create a user using python manage.py createsuperuser to generate a token.
  7. After creating a user, use the command python manage.py drf_create_token <your_username> your result will be like this Generated token 893f38d0382f9bfaaf69784cfbd5bb31110d1856 for user <username>
  8. Now, run the server using python manage.py runserver

Now you api is live on localhost 8000

I have used POSTMAN to test the endpoints of the api.

Because, of encapsulating the urls by token based authentication, we have to add the token everytime in the request in its header. We have to add it like this: Authorization: Token 893f38d0382f9bfaaf69784cfbd5bb31110d1856

Look at the following image: Screenshot 2024-05-09 172528

For the post request, you have to enter the url in address bar and select the POST from the dropdown. Enter the data inside Body as shown in image: image

In this way, you can use POSTMAN to check your all the endpoints.