# Communication to Care The Django website for **Communication to Care**, published at **com2care.com**. It presents the com2care medical-imaging research platform, product modules, learning videos, downloads, FAQs, and support information. ## Start with Docker Docker Compose includes working local defaults, database migrations, demo content, and the first admin account. No setup command or `.env` file is required for a local demonstration. ```bash docker compose up -d --build ``` Open: - Website: - Admin: Initial local admin credentials: ```text Username: admin Password: cmosV6Tw46Odv7UN ``` Change the password immediately after the first login using **Django Admin → Change password**. The startup process never resets an existing admin password unless credential synchronization is explicitly enabled. ## Automatic startup behavior Every web-container start performs these idempotent steps: 1. Wait for PostgreSQL. 2. Collect static files. 3. Apply Django migrations. 4. Normalize public database text and URLs to the Communication to Care identity. 5. Seed demonstration content only when all public content tables are empty. 6. Create the configured admin account only when it does not exist. 7. Start Django or Gunicorn. Demo content includes: - A com2care product with five medical-imaging modules. - Articles, structured specifications, FAQs, and release examples. - Homepage and About page sections with local images. - A generated Communication to Care hero image. - Relevant external YouTube tutorials for DICOM review and image segmentation. - `support@com2care.com` contact data. Content created or edited by an admin is preserved on later container restarts. ## Optional configuration Copy `.env.example` to `.env` only when you want to override the local defaults: ```bash cp .env.example .env ``` Important variables: | Variable | Purpose | |---|---| | `DJANGO_SECRET_KEY` | Required strong secret for production | | `ALLOWED_HOSTS` | Hostnames, including `com2care.com` | | `CSRF_TRUSTED_ORIGINS` | Full trusted origins with `https://` | | `POSTGRES_DB` | PostgreSQL database name | | `POSTGRES_USER` | PostgreSQL user | | `POSTGRES_PASSWORD` | PostgreSQL password | | `DJANGO_SUPERUSER_ENABLED` | Set `False` to disable automatic admin creation | | `DJANGO_SUPERUSER_USERNAME` | First admin username | | `DJANGO_SUPERUSER_EMAIL` | First admin email | | `DJANGO_SUPERUSER_PASSWORD` | First admin password | | `DJANGO_SUPERUSER_SYNC_PASSWORD` | Set `True` for one restart to rotate an existing admin password from environment values | For a server-side password rotation, set the new `DJANGO_SUPERUSER_PASSWORD`, temporarily set `DJANGO_SUPERUSER_SYNC_PASSWORD=True`, restart the web service once, then restore it to `False`. An admin can always change their own password through Django Admin without changing server configuration. ## Production Use strong values in `.env`, terminate TLS with a reverse proxy, and start only the production Compose file: ```bash docker compose -f docker-compose.yml up -d --build ``` At minimum, replace these local defaults in production: - `DJANGO_SECRET_KEY` - `POSTGRES_PASSWORD` - `DJANGO_SUPERUSER_PASSWORD` - `SECURE_SSL_REDIRECT=True` The default production host configuration already includes `com2care.com` and `www.com2care.com`. ## Manual development Requirements: - Python 3.12+ - PostgreSQL 14+ ```bash python -m venv .venv source .venv/bin/activate pip install -r requirements-dev.txt cp .env.example .env python manage.py migrate python manage.py seed_content --if-empty python manage.py ensure_superuser python manage.py runserver ``` ## Management commands ```bash # Add demo data only to a completely empty public database python manage.py seed_content --if-empty # Intentionally replace all public content with the demo dataset python manage.py seed_content --flush # Normalize existing public text, slugs, URLs, and email addresses python manage.py normalize_brand # Create or optionally synchronize the configured admin python manage.py ensure_superuser ``` ## Tests ```bash python manage.py test apps ``` or: ```bash pytest ``` ## Project structure ```text config/ Django settings and root URLs apps/core/ Branding, contact settings, bootstrap commands apps/pages/ Home, About, FAQ, Contact, custom pages, videos apps/products/ Products, articles, releases, product videos templates/ Django templates static/css/main.css Site design system static/images/ com2care brand and editorial assets static/js/main.js Navigation and interaction behavior docker-compose.yml PostgreSQL and production web service docker-compose.override.yml Local development override entrypoint.sh Automated database and content bootstrap ``` ## Technology - Django - PostgreSQL 16 - Gunicorn - WhiteNoise - Docker Compose - Vanilla HTML, CSS, and JavaScript