Skip to content

Django Rest API

Notifications You must be signed in to change notification settings

hugowth/demo-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo API

Environment

Prerequisite

  • python 3.12.0

Install python dependencies

  • brew install pyenv pipenv
  • pipenv install

Django ORM migrations

Run these two commands only when changes are made to the Django models

# create migration files
python manage.py makemigrations
# or
pipenv run makemigrations

# apply the migration operations
python manage.py migrate
# or
pipenv run migrate

Run development server

create .env in root directory, you can see the .env.sample

python manage.py runserver

It will start a local server at localhost:8000 and you can access the API The API document at localhost:8000/redoc/

Testing

python manage.py test

API Document

This project uses drf-spectacular to generate the Redoc and OpenAPI schema.