/DDP_backend

Django app for the DDP platform

Primary LanguagePython

DDP_backend

Django application for the DDP platform's management backend. Exposes API endpoints for the management frontend to communicate with, for the purposes of

  • Onboarding an NGO client
  • Adding users from the client-organization
  • Creating a client's workspace in our Airbyte installation
  • Configuring that workspace i.e. setting up sources, destinations and connections
  • Configuring data ingest jobs in our Prefect setup
  • Connecting to the client's dbt GitHub repository
  • Configuring dbt run jobs in our Prefect setup

Development conventions

Api end points naming

  • REST conventions are being followed.
  • CRUD end points for a User resource would look like:
    • GET /api/users/
    • GET /api/users/user_id
    • POST /api/users/
    • PUT /api/users/:user_id
    • DELETE /api/users/:user_id
  • Route parameteres should be named in snake_case as shown above.

Code style

  • Pep8 has been used to standardized variable names, classes, module names etc.
  • Pylint is the linting tool used to analyze the code as per Pep8 style.
  • Black is used as the code formatter.

Setting up your vscode env

  • Recommended IDE is VsCode.
  • Install the pylint extension in vscode and enable it.
  • Set the default format provider in vscode as black
  • Update the vscode settings.json as follows
    { "editor.defaultFormatter": null, "python.linting.enabled": true, "python.formatting.provider": "black", "editor.formatOnSave": true }

Running pylint

  • In your virtual environment run pylint ddpui/

Setup instructions

  • pyenv local 3.10

  • pyenv exec python -m venv venv

  • source venv/bin/activate

  • pip install --upgrade pip

  • pip install -r requirements.txt

  • create .env from .env.template

  • python manage.py migrate

  • python manage.py runserver