Files
web_django_template/.env.example
T
westfarn 97b8607bf2 Add campaign UTM links and piha.li shortener (#4)
## Summary
- Port Monica campaign UTM + piha.li minting into always-on `core` (`shortener.py`, `campaign_utm.py`) so `email_sms` and `directmail` stay optional and never import each other.
- `utm_source` is a slug of `SITE_NAME` (override with `UTM_SOURCE`). Email gets an HTML `data-campaign-utm` link; SMS gets a plain URL; postcard QR only — no body inject.
- Live composer mints through login+CSRF `POST /portal/campaigns/short-link/` (registered only when an outreach app is installed). Empty `SHORTENER_*` falls back to the long UTM URL.

Reference: [monica_site PR #10](ai_ml_operations/monica_site#10)

Closes #3

## Test plan
- [x] `cd site && uv run python manage.py test` (125 tests)
- [ ] Email composer: type a name, confirm HTML link + `utm_campaign` updates, save draft
- [ ] SMS composer: plain `piha.li` (or long UTM if shortener unset) in the body
- [ ] Postcard composer: QR copies the tracked URL; campaign body has no `utm_source`
- [ ] Campaign report pages show the same panel
- [ ] With `FEATURE_EMAIL_SMS` and `FEATURE_DIRECT_MAIL` off, no extra nav and no `/portal/campaigns/short-link/` route

Reviewed-on: #4
2026-09-01 13:36:01 -07:00

110 lines
3.9 KiB
Bash

# Local development defaults. Copy to `.env` (gitignored) — never commit secrets.
# docker compose auto-loads `.env` for ${VAR} substitution into the web container.
#
# After seeding a client: scripts/bootstrap-client.sh <slug> "<Site Name>" <domain>
# then copy this file and fill secrets.
DJANGO_ENV=dev
DJANGO_DEBUG=true
DJANGO_SECRET_KEY=dev-only-change-me
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1,0.0.0.0
# Leave empty for SQLite, or point at local compose Postgres:
# DATABASE_URL=postgres://client_site:client_site@127.0.0.1:5432/client_site
SITE_UNDER_CONSTRUCTION=false
SITE_NAME=Your Company
SITE_TAGLINE=A tagline for the public site
PUBLIC_SITE_URL=http://127.0.0.1:8000
CONTACT_PHONE=
CONTACT_EMAIL=hello@example.com
CONTACT_ADDRESS=
CONTACT_SERVICE_AREA=
CREDIT_NAME=AI ML Operations, LLC
CREDIT_URL=https://aimloperations.com
# ---------------------------------------------------------------------------
# Catalog feature flags
# Local/dev defaults ON so the template is a working seed.
# Client prod/beta secrets: false unless that add-on was purchased.
# Disabled apps are omitted from INSTALLED_APPS (no models, admin, URLs, nav).
# ---------------------------------------------------------------------------
FEATURE_EMAIL_SMS=true
FEATURE_DIRECT_MAIL=true
FEATURE_BLOG=true
FEATURE_PAYMENTS=true
FEATURE_SOCIAL=true
FEATURE_SOCIAL_AI=true
# reCAPTCHA (optional locally — form skips captcha when empty)
RECAPTCHA_PUBLIC_KEY=
RECAPTCHA_PRIVATE_KEY=
# SMTP2GO — required when FEATURE_EMAIL_SMS=true in beta/prod
EMAIL_HOST=mail.smtp2go.com
EMAIL_HOST_USER=
EMAIL_HOST_PASSWORD=
EMAIL_PORT=2525
EMAIL_USE_TLS=true
# Inbox From. Docker Compose .env cannot parse: "Name" <addr>
# Use bare address (SITE_NAME is wrapped) OR one quoted string:
# DEFAULT_FROM_EMAIL="Your Company <noreply@example.com>"
DEFAULT_FROM_EMAIL=noreply@example.com
# Console (default in DJANGO_ENV=dev) prints mail to container logs.
# EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
SMTP2GO_SMS_API_KEY=
# Unified SMTP2GO webhook (email + SMS): …/portal/messaging/webhooks/smtp2go/
# Authorization = Bearer + this secret.
SMTP2GO_WEBHOOK_SECRET=
# Postcards — PCM Integrations. Required when FEATURE_DIRECT_MAIL=true in beta/prod
POSTCARD_PROVIDER=pcm
PCM_API_KEY=
PCM_API_SECRET=
# PCM_CHILD_REF_NBR=
PCM_WEBHOOK_SECRETS=
# PCM_WEBHOOK_SECRET=
# Quote JSON (compose/shell break on bare {…, …}).
# PCM_RETURN_ADDRESS='{"firstName":"Jane","lastName":"Doe","address":"123 Main","city":"Town","state":"IL","zipCode":"60189"}'
PCM_RETURN_ADDRESS=
# Stripe — required when FEATURE_PAYMENTS=true
STRIPE_SECRET_KEY=
STRIPE_PUBLISHABLE_KEY=
STRIPE_WEBHOOK_SECRET=
STRIPE_CURRENCY=usd
# Social — SOCIAL_TOKEN_ENCRYPTION_KEY required when FEATURE_SOCIAL=true
# LinkedIn / Instagram App ID + Secret: Portal → Social accounts (not env).
META_APP_ID=
META_APP_SECRET=
# Generate: python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
SOCIAL_TOKEN_ENCRYPTION_KEY=
# Ollama (LAN) — FEATURE_SOCIAL_AI. Default is the internal host, not public Ollama.
OLLAMA_BASE_URL=http://10.0.0.128:11434
OLLAMA_MODEL=llama3.2
# URL shortener (piha.li). Empty locally = long UTM URLs in campaigns.
# Call the API host, never https://piha.li (that host only 302s).
# Required in beta/prod when FEATURE_EMAIL_SMS or FEATURE_DIRECT_MAIL is on.
SHORTENER_BASE_URL=
SHORTENER_API_TOKEN=
# UTM_SOURCE= # optional override; default is a slug of SITE_NAME
# Local shortener compose:
# SHORTENER_BASE_URL=http://127.0.0.1:8005
# SHORTENER_API_TOKEN=acme:dev-only-token
# Nominatim (LAN) — address autocomplete via Django /api/address-suggest/
NOMINATIM_BASE_URL=http://10.0.0.128:8089
NOMINATIM_TIMEOUT_SECONDS=8
NOMINATIM_COUNTRY_CODES=us
# Tianji analytics (off in local/dev by default)
TIANJI_ENABLED=false
TIANJI_TRACKER_URL=https://tianji.aimloperations.com/tracker.js
TIANJI_WEBSITE_ID=
# DISPATCH_DUE_INTERVAL_SECONDS=15
GUNICORN_WORKERS=2