Skip to content

A simple RESTful API built using Django Rest Framework.

Notifications You must be signed in to change notification settings

LucasSD/market_research

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

The aim of this project is to create a simple API using Django Rest Framework which allows interaction between two Django models. I have used HyperlinkedModelSerializer classes and ModelViewSets to make the API as RESTful as possible, while allowing for full CRUD functionality with the simplest code possible.

Technologies

Python 3.6.2, Django==2.2.24, Django Rest Framework== 3.10.0, Coverage==5.5, Black

Getting Started

Please follow the instructions below to run this application.

1 - download this repo as a zip file and unzip it to your working directory.
2 - install Python 3.6.2 or later

(Optional) Create and use a virtual environment:

python -m venv env

source env/bin/activate

Install dependencies:

pip install -r requirements.txt

Run my tests (all should pass):

python manage.py test

Optional: run Coverage (using batch file) to receive a test coverage report in stdout

cvrg.bat

Build the database:

python manage.py migrate

Start the Django development server:

python manage.py runserver

After these commands, you should be able to see the API root at http://localhost:8000/ via a redirection.

You will need to create a super user if you want to access the Django admin site (https://docs.djangoproject.com/en/3.2/ref/contrib/admin/): to do this, run python manage.py createsuperuser and follow the instructions.

Project Status

Still being developed.

To do:
  • add permissions/logins

  • add stricter tests for updating object fields

  • use Django mixers for tests or try Factory Boy and Faker packages

  • add gettext_lazy wherever required for future translations

  • add help_text where useful

  • add constraint check so that it's not possible to save invalid choices in the Django shell

  • add better messages for all endpoints

  • produce more detailed documentation using Swagger or another package