The document portal is a Django app (portal) mounted at /portal/. It lets the
OBC team upload and manage per-Provider documents, and lets Provider Members
access their own archive, with email notifications and digests.
This file documents the settings the portal needs. They live in the environment-specific Django settings file, which is git-ignored (it holds secrets), so they are not version-controlled and must be added by hand to the production settings at deploy time.
- The active settings module is
src/intrepid/settings.py, which is a symlink to the environment file —dev_settings.pylocally; on the server it is symlinked toprod_settings.pybyinfrastructure/ansible/virtualenv/symlink_settings.yml. dev_settings.py,settings.pyandprod_settings.pyare all listed in.gitignore, so changes to them are not committed.- At deploy time you must add the two blocks below to
prod_settings.pyon the server, or the portal will not load and the notification cron job will error.
Add "portal" to INSTALLED_APPS:
INSTALLED_APPS = [
...,
"portal",
]MIDDLEWARE must contain django.middleware.locale.LocaleMiddleware,
placed after SessionMiddleware and before CommonMiddleware:
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.locale.LocaleMiddleware", # <-- add this line
"django.middleware.common.CommonMiddleware",
...,
]Without it, the site's EN/DE language switcher stores the choice but no
request ever activates it — every page (and every translated string) is
served in the default language. Check prod_settings.py on the server at
deploy time; settings files are git-ignored, so this line must be added by
hand, exactly like the constants below. (portal.tests.test_i18n guards
this in any environment where the test suite runs.)
The portal needs the datetime import and four DOC_* constants:
import datetime
# Document portal
DOC_NOTIFICATION_DELAY = datetime.timedelta(hours=2)
DOC_DIGEST_DAILY_HOUR = 9 # daily digests are sent at this hour
DOC_DIGEST_WEEKLY_DAY = 0 # weekday for weekly digests (Python weekday(): 0 = Monday)
DOC_DIGEST_MONTHLY_DAY = 1 # day-of-month for monthly digests| Constant | Default | What it controls |
|---|---|---|
DOC_NOTIFICATION_DELAY |
timedelta(hours=2) |
Grace window before an immediate notification email is allowed to fire. This lets OBC delete and re-upload a mistakenly-uploaded document within the window without any email going out. |
DOC_DIGEST_DAILY_HOUR |
9 |
Hour of day (project timezone, 24-hour clock) at which daily digest emails are sent. |
DOC_DIGEST_WEEKLY_DAY |
0 (Monday) |
Day of the week for weekly digests, using Python's date.weekday() (0 = Monday … 6 = Sunday). |
DOC_DIGEST_MONTHLY_DAY |
1 |
Day of the month on which monthly digests are sent. |
All four are read by src/portal/notifications.py when computing when each queued
notification becomes due. They are also present in dev_settings.py for local
development.
These steps are version-controlled (migrations and the cron installer travel with the code) — listed here so a deploy is complete:
- Run migrations:
uv run ./manage.py migrate. This creates the portal tables and seeds the two starter document types, theOBC Team/Provider Membersgroups, the four email templates, and the portal's translatable UI strings (cms.SiteText). Themailmigrations also add the translation columns toEmailTemplate(subject_en/de,body_en/de) and copy each existing template'ssubject/bodyinto its English columns, so every existing send path keeps rendering after the upgrade — no manual step is required. OBC staff can then edit and translate the four portal notification emails from Portal → Email copy (/portal/obc/email-templates/). - Install the cron job that drains the notification queue every 15 minutes:
uv run ./manage.py install_cron(adds thesend_document_notificationsjob). - (Optional) populate translations:
uv run ./manage.py update_translation_fields, then translate the seededSiteText/DocumentTypestrings into German from the usual translation tooling.
The portal lives at /portal/. The older configuration dashboard was moved from
/dashboard/ to /staff/ and is reachable only by typing that URL directly; the
top-right "Dashboard" link in the site navigation now points at the portal.
See docs/2026-04-document-portal-plan.md for the full design and implementation
plan.