fix: separate logo and hero icon

This commit is contained in:
mohamad
2026-08-03 16:29:25 +03:30
parent 04b6e9049e
commit 4fc4282f0f
45 changed files with 900 additions and 495 deletions
+125 -231
View File
@@ -1,278 +1,172 @@
# Radiuma Website
# Communication to Care
Django MVT informational website for **Radiuma**, showcasing the **Radiuma** medical imaging and radiomics software suite.
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.
## Tech Stack
## Start with Docker
| Layer | Technology |
|---|---|
| Backend | Django 5.1 (MVT) |
| Database | PostgreSQL 16 |
| Static files | WhiteNoise (with Brotli compression) |
| Application server | Gunicorn |
| Containerization | Docker + Docker Compose |
| Frontend | Vanilla HTML/CSS/JS (no framework) |
## Project Structure
```
tecvico_website/
├── config/ # Django project configuration
│ └── settings/
│ ├── base.py # Shared settings
│ ├── development.py # Dev settings (DEBUG=True, dotenv)
│ └── production.py # Production settings (security headers)
├── apps/
│ ├── core/ # Context processors, management commands
│ │ └── management/commands/seed_content.py
│ ├── products/ # MainProduct, SubProduct, Article, ArticleSection
│ └── pages/ # FAQEntry, DownloadItem; static pages
├── templates/ # Global templates
│ ├── base.html
│ ├── partials/
│ └── pages/ & products/
├── static/
│ ├── css/main.css # Full design system (dark glass/ice theme)
│ └── js/main.js # Navbar, FAQ accordion, scroll effects
├── Dockerfile
├── docker-compose.yml # Production compose
├── docker-compose.override.yml # Development compose overrides
└── entrypoint.sh # DB wait + migrate on container start
```
## URL Map
| URL | View | Description |
|---|---|---|
| `/` | `HomeView` | Landing page |
| `/about/` | `AboutView` | What is Radiuma |
| `/products/` | `ProductOverviewView` | All main products |
| `/products/<main-slug>/` | `MainProductDetailView` | Main product + sub-products |
| `/products/<main-slug>/<sub-slug>/` | `SubProductDetailView` | Sub-product + articles |
| `/downloads/` | `DownloadsView` | Download items by platform |
| `/faq/` | `FAQView` | FAQ entries |
| `/contact/` | `ContactView` | Contact info |
| `/admin/` | Django Admin | Admin panel |
## Data Model
```
MainProduct
└── SubProduct (FK → MainProduct)
└── Article (FK → SubProduct)
└── ArticleSection (FK → Article) ← key/value metadata
FAQEntry ← admin-managed FAQ items
DownloadItem ← admin-managed download links per platform
```
---
## Local Development (with Docker)
### Prerequisites
- Docker Desktop (or Docker Engine + Compose plugin)
### 1. Clone & configure
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: <http://localhost:8000>
- Admin: <http://localhost:8000/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
git clone <repo-url> tecvico_website
cd tecvico_website
cp .env.example .env
```
Edit `.env` and set at minimum:
Important variables:
```
DJANGO_SECRET_KEY=your-very-secure-random-key
POSTGRES_PASSWORD=choose-a-strong-password
```
| 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 |
### 2. Start services (development mode)
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.
The `docker-compose.override.yml` automatically activates when you run `docker compose up`, mounting the source code and using the development settings.
## Production
Use strong values in `.env`, terminate TLS with a reverse proxy, and start only the production
Compose file:
```bash
docker compose up --build
docker compose -f docker-compose.yml up -d --build
```
The app is available at **http://localhost:8000**
At minimum, replace these local defaults in production:
### 3. Create a superuser
- `DJANGO_SECRET_KEY`
- `POSTGRES_PASSWORD`
- `DJANGO_SUPERUSER_PASSWORD`
- `SECURE_SSL_REDIRECT=True`
```bash
docker compose exec web python manage.py createsuperuser
```
The default production host configuration already includes `com2care.com` and
`www.com2care.com`.
### 4. Seed initial content
## Manual development
Populate the database with content scraped and adapted from visera.ca:
```bash
docker compose exec web python manage.py seed_content
```
To flush and re-seed from scratch:
```bash
docker compose exec web python manage.py seed_content --flush
```
---
## Local Development (without Docker)
### Prerequisites
Requirements:
- Python 3.12+
- PostgreSQL 14+
### 1. Set up virtual environment
```bash
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
source .venv/bin/activate
pip install -r requirements-dev.txt
```
### 2. Configure environment
```bash
cp .env.example .env
```
Edit `.env`:
```
DJANGO_SECRET_KEY=your-key
POSTGRES_DB=tecvico
POSTGRES_USER=your_pg_user
POSTGRES_PASSWORD=your_pg_password
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
```
### 3. Create the database
```bash
createdb tecvico
```
### 4. Run migrations & seed
```bash
python manage.py migrate
python manage.py seed_content
python manage.py createsuperuser
```
### 5. Start development server
```bash
python manage.py seed_content --if-empty
python manage.py ensure_superuser
python manage.py runserver
```
---
## Management commands
## Running Tests
```bash
# Add demo data only to a completely empty public database
python manage.py seed_content --if-empty
### With Django test runner
# 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
```
### With pytest (requires `requirements-dev.txt`)
or:
```bash
pytest
```
### With coverage report
## Project structure
```bash
coverage run -m pytest
coverage report -m
coverage html # Generates htmlcov/index.html
```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
## Production Deployment
### 1. Build and start production containers
Remove `docker-compose.override.yml` (or don't override it) and pass production environment variables:
```bash
DJANGO_SETTINGS_MODULE=config.settings.production \
docker compose -f docker-compose.yml up --build -d
```
### 2. Production `.env` checklist
| Variable | Notes |
|---|---|
| `DJANGO_SECRET_KEY` | Use `python -c "import secrets; print(secrets.token_urlsafe(50))"` |
| `DEBUG` | Must be `False` |
| `ALLOWED_HOSTS` | Comma-separated: `yourdomain.com,www.yourdomain.com` |
| `CSRF_TRUSTED_ORIGINS` | `https://yourdomain.com` |
| `POSTGRES_PASSWORD` | Strong random password |
| `SECURE_SSL_REDIRECT` | `True` when behind TLS termination |
### 3. Reverse proxy (recommended)
Place an Nginx or Caddy reverse proxy in front of Gunicorn for TLS termination and serving static files (or let WhiteNoise handle statics directly).
---
## Admin Panel
Access Django Admin at `/admin/` with superuser credentials.
### What you can manage
| Model | Description |
|---|---|
| **Main Products** | Top-level products with nested sub-products inline |
| **Sub Products** | Modules within a main product; articles editable inline |
| **Articles** | Article entries with section key/values inline |
| **Article Sections** | Individual key-value metadata rows |
| **FAQ Entries** | Accordion FAQ items (order, active toggle) |
| **Download Items** | Platform download links (Windows/macOS/Linux) |
---
## Seed Content
The `seed_content` command populates:
- **Radiuma** (MainProduct) with 5 sub-products:
- Image Processing
- Radiomics Features
- Medical Image Visualization
- Format Conversion
- Workflow Management
- Articles and sections for each sub-product
- 6 FAQ entries
- 3 download items (Windows active, macOS/Linux coming soon)
Content is adapted from the original [visera.ca](https://visera.ca) website.
---
## Design System
The website uses a custom dark-glass design combining:
- **visera.ca** aesthetic — dark background, organic blob animations, blue/teal accents
- **Apple visionOS Ice** aesthetic — frosted glass panels (`backdrop-filter: blur`), translucent cards, soft gradients
Key CSS custom properties are in `static/css/main.css` under `:root`.
---
## License
Content is adapted from visera.ca under CC BY-NC-SA. Software code is proprietary to Radiuma.
- Django
- PostgreSQL 16
- Gunicorn
- WhiteNoise
- Docker Compose
- Vanilla HTML, CSS, and JavaScript