Skip to content

dscdut/django-rest-framework-boilerplate

Repository files navigation

Django REST framework template

drf Logo

Prerequisites

Setup local development

Setup virtual environment

In side the django-templates apply these following commands

# Create virtual env
python -m venv venv

# Activate the venv
# On window
.\venv\Scripts\activate

# On MacOs
source ./venv/bin/activatee

# Deactivate the venv
deactivate

Setup dependencies & environment

  1. Install dependencies
pip install -r requirements.txt
  1. Update database information in boilerplate/settings/local.py or copy .env.example into .env

Setup database

  1. Init database
docker compose up -d db
  1. Migrate database
python manage.py makemigrations
python manage.py migrate
  1. Seed the data
python manage.py loaddata boilerplate/database/seed.json

Run up the server

python manage.py runserver 0.0.0.0:8000

Or you can just use docker compose

docker compose up -d init_dev

🐞 Fix bugs docker: If the services cannot run synchronously you can try run the them in the following order

docker compose up -d db
docker compose up -d init_dev

Open browser and access localhost:8000/docs to view swagger documentation

Swagger docs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published