Author SHA1 Message Date
westfarn 00686ba53f Update workflow to use server-infra 2026-07-08 06:02:17 -05:00
westfarnandCursor d2f2409a53 fix(static): don't 500 on missing manifest entries at runtime
CI / test (pull_request) Successful in 10s
Unit Tests / test (pull_request) Successful in 9s
Templates reference public/img/logo.png (favicon, brand logo, social
share images) which isn't present in the repo. With the strict manifest
storage this raised ValueError at request time -> HTTP 500. Override
stored_name (and set manifest_strict=False) to fall back to the plain
name so a missing static degrades to a broken asset instead of a 500,
matching the previous non-manifest behaviour.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 13:18:49 -05:00
westfarnandCursor 5d378b7b19 fix(settings): accept JSON-array env lists in env_list
CI / test (pull_request) Successful in 10s
Unit Tests / test (pull_request) Successful in 9s
The production .env stores DJANGO_ALLOWED_HOSTS as a JSON array (legacy
format), but env_list only split on commas, yielding broken entries like
'["aimloperations.com"' and causing DisallowedHost (HTTP 400) for every
request. Parse JSON arrays as well as comma-separated values.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 13:13:57 -05:00
westfarnandCursor 5899c1f14f fix(static): tolerate missing asset references in collectstatic
CI / test (pull_request) Successful in 10s
Unit Tests / test (pull_request) Successful in 10s
WhiteNoise's manifest storage strictly resolves every referenced file
during collectstatic, including sourceMappingURL comments in vendored
JS bundles. A missing .map (financial/js/.../dashboard-free.js.map)
broke the prod container at startup. Add TolerantManifestStaticFilesStorage
which leaves unresolved references untouched instead of raising.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 13:10:51 -05:00
westfarn a4b37a0bb0 g
CI / test (pull_request) Successful in 10s
Unit Tests / test (pull_request) Successful in 10s
2026-07-07 11:20:15 -05:00
westfarn 115c5ae319 Dockerize Django app with dev/beta/prod env config and uv.
CI / test (pull_request) Successful in 11s
Unit Tests / test (pull_request) Failing after 6s
Replace hardcoded settings with environment-driven config, add Docker
compose for local and production deploys, migrate from pip to uv, and
split Gitea workflows so PRs run tests only while master pushes deploy.
2026-07-07 05:58:44 -05:00
5 changed files with 31 additions and 42 deletions
+26 -6
View File
@@ -1,6 +1,6 @@
name: Deploy Company Site
# Runs after Unit Tests completes on master. Direct pushes only (not PRs).
# Deploy pipeline runs only on pushes to master (never on pull requests).
on:
workflow_run:
workflows: [Unit Tests]
@@ -8,14 +8,34 @@ on:
branches: [master]
jobs:
docker:
if: gitea.event.workflow_run.conclusion == 'success' && gitea.event.workflow_run.event == 'push'
test:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ gitea.event.workflow_run.head_sha }}
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Install dependencies
run: uv sync --frozen
- name: Run unit tests
env:
DJANGO_ENV: dev
DJANGO_SECRET_KEY: test-secret-key
run: |
cd company_site
uv run python manage.py test
docker:
runs-on: self-hosted
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build Docker image
run: docker compose build
@@ -33,7 +53,7 @@ jobs:
deploy:
if: gitea.event.workflow_run.conclusion == 'success' && gitea.event.workflow_run.event == 'push'
runs-on: self-hosted
needs: docker
needs: [test, docker]
env:
SERVER_INFRA_ROOT: /home/westfarn/Documents/repos/server-infra
steps:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

+1 -29
View File
@@ -1,40 +1,12 @@
from unittest.mock import patch
from django.contrib.auth.models import User
from django.test import Client, TestCase, override_settings
from django.urls import reverse
from .models import Contact, EmailMessage
from .models import Contact
from .seo import SERVICE_URL_NAMES, get_service_entries
class PreviewEmailAuthTests(TestCase):
def setUp(self):
self.client = Client()
self.user = User.objects.create_user(username="previewer", password="pass")
self.email = EmailMessage.objects.create(
subject="Preview subject",
body="Preview body content",
recipient="recipient@example.com",
)
self.url = reverse("preview_email", kwargs={"pk": self.email.pk})
def test_unauthenticated_user_is_redirected_to_login(self):
response = self.client.get(self.url)
self.assertEqual(response.status_code, 302)
self.assertIn("/accounts/login/", response.url)
def test_authenticated_user_can_preview_email(self):
self.client.login(username="previewer", password="pass")
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, "Preview subject")
self.assertContains(response, "Preview body content")
@override_settings(
DEBUG=True,
EMAIL_BACKEND="django.core.mail.backends.locmem.EmailBackend",
+4 -7
View File
@@ -18,14 +18,11 @@ services:
build: .
ports:
- "8000:8000"
# No required env_file — CI has no .env. Defaults below; for local secrets:
# docker compose --env-file .env up
env_file:
- .env
environment:
DJANGO_ENV: ${DJANGO_ENV:-dev}
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY:-dev-only-change-me}
DJANGO_DEBUG: ${DJANGO_DEBUG:-true}
DJANGO_ALLOWED_HOSTS: ${DJANGO_ALLOWED_HOSTS:-localhost,127.0.0.1,0.0.0.0}
DATABASE_URL: ${DATABASE_URL:-postgres://company_site:company_site@db:5432/company_site}
DJANGO_ENV: dev
DATABASE_URL: postgres://company_site:company_site@db:5432/company_site
depends_on:
db:
condition: service_healthy