Django App

  • Django project structure with apps under idk/
  • URL routing via per‑app urls.py
  • Views: class-based and function-based views in app views.py
  • Templates: server-rendered pages using Django templates
  • Settings profiles in config/settings/ (common, local, production)

Settings overview (common.py)

Core configuration lives in config/settings/common.py:

  • Apps and features
  • Installed apps: Django core, third‑party (DRF, Channels, Celery Beat, crispy‑forms, webpack‑loader, actstream, taggit, sorl, constance, health‑check, wkhtmltopdf), and local apps under idk/
  • Auth: Allauth (email login by default), custom user model users.User
  • Django REST Framework: token + session auth; default permission IsAuthenticated
  • Feature flags: GoFeatureFlag provider (No‑op by default)
  • Dynamic settings: django‑constance with database backend and multiple fieldsets
  • Services and infra
  • Database: DATABASE_URL env; ATOMIC_REQUESTS=True
  • Cache: Redis (via django_redis) keyed to CELERY_BROKER_URL by default
  • Static/media: STATICFILES_DIRSidk/static, MEDIA_ROOTidk/media
  • Templates: DIRS=[idk/templates], filesystem + app loaders, custom context processors in idk/core/context_processors.py
  • Webpack: webpack_loader referencing webpack-stats.json
  • Channels: Redis channel layer (channels_redis), host/port via env
  • Celery: broker/result = Redis; JSON serializers; timezone from project
  • Celery Beat: example schedule sync_all_members_activity_for_date at 02:00
  • Integrations
  • ClickUp, Toggl/Tempo, Pipedrive, FrontApp, QuickBooks, FreshBooks
  • Email defaults, Mailgun (anymail)
  • Logging and telemetry
  • OpenTelemetry logger provider (optional endpoint via OTEL_COLLECTOR_URL)
  • Structured console + OTEL handlers; idk logger at DEBUG
  • Security and i18n
  • Languages: English/Spanish; timezone America/New_York; CSRF trusted origins for ngrok

Local environment (local.py)

  • Debugging/dev tooling
  • DEBUG=True; template debug enabled
  • Email backend: console
  • Apps/middleware: debug_toolbar, django_extensions
  • Cache fallback
  • If REDIS_CACHE is false, use in‑memory LocMemCache
  • ALLOWED_HOSTS from env

Production environment (production.py)

  • Security and HTTPS
  • SecurityMiddleware first; HSTS, SSL redirect, secure cookies (__Secure-* names)
  • Static/media storage
  • AWS S3 with storages; collectfast; compressor integrated storage
  • Static URL served from S3; media to S3 media/
  • Templates use cached loader
  • Database and cache
  • DATABASE_URL required; Redis cache (django_redis) with ignore‑exceptions
  • Observability
  • Sentry SDK (Django + Celery integrations), sample rates from env
  • Logging configured for DB/backends, sentry, security, daphne
  • Webpack
  • webpack-stats-prod.json, cache disabled at loader level

Tip: use APP_ENVIRONMENT to switch context; ASGI_APPLICATION=config.asgi.application enables Channels in all envs.