This is a boilerplae for create a django project using rest framework. Currently uses local user login, but is setup to support 3rd party sso.
- Django Admin: http://127.0.0.1:8000/admin/
- Django Rest Framework docs: http://127.0.0.1:8000/docs/
- Django
- Django Rest Framework
- Loguru (better logging)
- Unfold (fancy admin)
- Spectacular (fancy api docs)
- Elements (interactive api docs)
- Poetry (dependency management)
- Pre-commit
- Ruff (code quality)
-
Install Poetry: https://python-poetry.org/docs/
-
Install the just cli tool https://github.com/casey/just
-
Start the server
This will spin up a local postgres db and run the server.
just start-api
Other commands can be foun by running
just --list
-
Access the admin at http://127.0.0.1:8000/admin/
- Default login is
admin@example.com
andHeadset6-Darkroom-Tamer
- Default login is
-
Create a
.env
in the root backend folder with the following content, only needed if not using the defaults:DJANGO_SECRET_KEY="super-secret-value-here" DATABASE_URL="postgresql://USER:PASS@HOST:5432/DB_NAME"
-
Setup the virtual environment
Poetry docs: https://python-poetry.org/docs/
# Install packages and enter venv poetry shell poetry install
-
Prepare the server
# Run migrations python manage.py migrate # Create a superuser python manage.py createsuperuser # Run the server python manage.py runserver
-
Access the admin at http://127.0.0.1:8000/admin/
- On the main "Dashboard", under "Django OAuth Toolkit", click "Applications"
- Create a new application by clicking the plus in the top right
- Copy the client id & secret, they will get used when setting up the frontend app
- Fill in the form with the following values:
- Client type:
Confidential
- Authorization grant type:
Resource owner password-based
- Name: anything you want
- Client type:
- Save the application
-
Setup the frontend at frontend/README.md