Configuration
Environment and settings
Trak uses environment variables and django-environ for settings. Most configuration should live in .env (local) or the runtime environment (staging/production).
Files
.envis for local development and is not committed..env.exampleis a template you can copy for local setup.
Precedence
Settings commonly look like:
SOME_VALUE = env("SOME_VALUE", default="")
If SOME_VALUE is set in the environment (even to an empty string), it overrides the default. Remove the variable entirely if you want the default to apply.
Key settings locations
trak/trak/main/settings/base.pytrak/trak/main/settings/dev.pytrak/trak/main/settings/prod.pytrak/trak/main/settings/test.py
Absolute URLs
Some URLs must be fully qualified (emails, Stripe callbacks, websocket URLs). Trak uses:
USE_HTTPS_IN_ABSOLUTE_URLSto togglehttpvshttps- The Django
Sitedomain in the database for hostname
Update the Site domain via Django admin to match your environment.
Feature flags
Trak uses Django Waffle for feature flags. Flags are managed in Django admin and can be enabled per-user or per-team.
import waffle
def my_view(request):
if waffle.flag_is_active(request, "new_feature"):
...
If Teams is enabled, Trak uses a custom flag model that supports team-based rollout.
Project metadata and SEO
Trak defines PROJECT_METADATA in settings, which powers default page titles, meta tags, and social sharing.
PROJECT_METADATA = {
"NAME": "trak",
"URL": "https://app.ezwaste.io",
"DESCRIPTION": "Hazardous waste tracking application",
"IMAGE": "https://upload.wikimedia.org/wikipedia/commons/2/20/PEO-pegasus_black.svg",
"KEYWORDS": "waste, hazardous, waste management, EPA, RCRA, RCRAInfo",
"CONTACT_EMAIL": "david.graham@ezwaste.io",
}
You can override page titles in views by providing page_title in the template context, or in templates by overriding the page_title block.
Email and auth
Trak uses django-anymail for transactional email providers (Mailgun, SES, Postmark, etc.).
Configure the email backend and provider credentials in environment variables.
Common settings:
EMAIL_BACKENDDEFAULT_FROM_EMAILSERVER_EMAIL- Provider-specific settings (e.g.
MAILGUN_API_KEY)
Authentication
User sign-up and login use django-allauth with configurable settings.
Examples:
- Require email verification:
python ACCOUNT_EMAIL_VERIFICATION = "mandatory" - Enable login-by-code:
python ACCOUNT_LOGIN_BY_CODE_ENABLED = True
Social login providers require external app registration and corresponding env vars (e.g. Google OAuth).
Media storage
By default, Trak stores media files on the local filesystem (see MEDIA_ROOT).
S3-compatible storage
To use S3-compatible storage, set:
USE_S3_MEDIA=True
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
AWS_STORAGE_BUCKET_NAME=...
This switches the default storage backend to the S3 implementation defined in trak/apps/web/storage_backends.py.
Google Cloud Storage
In production, trak/main/settings/prod.py configures Google Cloud Storage via GS_BUCKET_NAME.
If you are not using GCS, override this in your environment or settings.