No description
Find a file
2026-08-08 06:34:44 -04:00
apps Prefix proxy swagger paths with /api to match actual routes 2026-08-03 17:12:43 +03:30
config add api infront of the proxy route 2026-08-03 16:17:23 +03:30
utils add fallback 2026-08-01 10:15:23 +03:30
.env.example remove unnecessary clients 2026-08-01 09:27:10 +03:30
.gitignore FEATURE(crm-backend): add other service clients 2026-06-01 13:41:36 +03:30
Dockerfile FIX(admin): adding Dockerfile 2026-08-01 18:42:23 +03:30
manage.py init project, add excel generation and mock api calls 2026-05-20 15:15:37 +03:30
README.md init project, add excel generation and mock api calls 2026-05-20 15:15:37 +03:30
requirements.txt FIX(admin): adding req 2026-08-01 19:31:59 +03:30
run.sh FIX(admin): adding Dockerfile 2026-08-01 18:49:05 +03:30

CRM Backend

Django + Django REST Framework backend scaffold.

Local setup

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
python manage.py migrate
python manage.py runserver

Health check:

curl http://127.0.0.1:8000/api/health/

Generate an Excel report:

curl -X POST http://127.0.0.1:8000/api/reports/generate/ \
  -H "Content-Type: application/json" \
  -o user-report.xlsx \
  -d '{
    "report_type": "user",
    "filters": {
      "status": "active"
    }
  }'

Supported report types:

  • user
  • tickets

Settings

The project defaults to config.settings.local for development. Environment variables are read from .env when it exists.

Use config.settings.production in production:

export DJANGO_SETTINGS_MODULE=config.settings.production

Important variables:

  • SECRET_KEY: Django secret key. Required in production.
  • DEBUG: True for local development, False otherwise.
  • ALLOWED_HOSTS: comma-separated host names.
  • DATABASE_URL: database connection URL. Defaults to local SQLite.
  • CORS_ALLOWED_ORIGINS: comma-separated frontend origins.
  • CSRF_TRUSTED_ORIGINS: comma-separated trusted origins for unsafe requests.
  • SERVICE_REQUEST_TIMEOUT: timeout in seconds for downstream service calls.
  • OAUTH2_PROVIDER_PUBLIC_URL: public OAuth2 issuer/provider URL.
  • OAUTH2_PROVIDER_PRIVATE_URL: private OAuth2 provider URL used by the backend.
  • OAUTH2_CLIENT_ID: OAuth2 client credentials ID.
  • OAUTH2_CLIENT_SECRET: OAuth2 client credentials secret.
  • OAUTH2_SCOPES: space-separated OAuth2 scopes.

The service client currently builds the client-credentials token endpoint as:

{OAUTH2_PROVIDER_PRIVATE_URL}/oauth2/token