Skip to content

Latest commit

 

History

History
91 lines (60 loc) · 2.55 KB

README.md

File metadata and controls

91 lines (60 loc) · 2.55 KB

Django

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.

Quick Links

Technologies used

Quick Setup

  1. Install Poetry: https://python-poetry.org/docs/

  2. Install the just cli tool https://github.com/casey/just

  3. 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

  4. Access the admin at http://127.0.0.1:8000/admin/

    • Default login is admin@example.com and Headset6-Darkroom-Tamer

Manual Setup

  1. 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"
  2. Setup the virtual environment

    Poetry docs: https://python-poetry.org/docs/

    # Install packages and enter venv
    poetry shell
    poetry install
  3. Prepare the server

    # Run migrations
    python manage.py migrate
    
    # Create a superuser
    python manage.py createsuperuser
    
    # Run the server
    python manage.py runserver
  4. Access the admin at http://127.0.0.1:8000/admin/

    1. On the main "Dashboard", under "Django OAuth Toolkit", click "Applications"
    2. Create a new application by clicking the plus in the top right
    3. Copy the client id & secret, they will get used when setting up the frontend app
    4. Fill in the form with the following values:
      • Client type: Confidential
      • Authorization grant type: Resource owner password-based
      • Name: anything you want
    5. Save the application
  5. Setup the frontend at frontend/README.md