Skip to content

Latest commit

 

History

History
80 lines (60 loc) · 1.37 KB

README.md

File metadata and controls

80 lines (60 loc) · 1.37 KB

This is a simple API built using Django Rest Framework.

Requirements

  • Python version 3.6.x
  • virtualenv
  • pip
  • django
  • django rest framwork (DRF)

Setup & Running the app

  1. Clone repository using GIT
> git clone [email protected]:wreeecks/douugh.git
  1. Change directory to src
> cd douugh
  1. Create and activate virtual environment
> virtualenv env
> source env/bin/activate
  1. Install Django and DRF
> pip install -r requirements.txt
  1. Make initial migration then run migrate
> python manage.py makemigrations
> python manage.py migrate
  1. (Optional) Create a Django superuser
> python manage.py createsuperuser
  1. Run server
> python manage.py runserver

#output
Django version 2.2.1, using settings 'codetest.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Creating a user using DRF browsable api

  1. Open http://localhost:8000/api/create on any browser
  2. Fill up the form, then click "Post" button.

Logging-in using DRF browsble api

  1. Open http://localhost:8000/api/login on any browser
  2. Fill up the form, then click "Post" button. This should return a 32 bit string token.

Testing

  1. Change dir to the application root directory
> cd douughcodetest
  1. Activate virtual env
> source env/bin/activate
  1. Run test
> python manage.py test