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_URLenv;ATOMIC_REQUESTS=True - Cache: Redis (via
django_redis) keyed toCELERY_BROKER_URLby default - Static/media:
STATICFILES_DIRS→idk/static,MEDIA_ROOT→idk/media - Templates:
DIRS=[idk/templates], filesystem + app loaders, custom context processors inidk/core/context_processors.py - Webpack:
webpack_loaderreferencingwebpack-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_dateat 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;
idklogger 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_CACHEis false, use in‑memoryLocMemCache - 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_URLrequired; 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.