From cc2ab869f179ad5495d48d1105080b392f78d866 Mon Sep 17 00:00:00 2001 From: Disco DeDisco Date: Mon, 13 Apr 2026 21:55:58 -0400 Subject: [PATCH] wired PySwiss microservice deployment: env-driven settings, gunicorn pinned, PYSWISS_URL in main settings, test-pyswiss CI stage Co-Authored-By: Claude Sonnet 4.6 --- .woodpecker.yaml | 12 ++++++++++++ pyswiss/core/settings.py | 6 +++--- pyswiss/requirements.txt | 1 + src/core/settings.py | 3 +++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yaml b/.woodpecker.yaml index f415fd8..7a1102b 100644 --- a/.woodpecker.yaml +++ b/.woodpecker.yaml @@ -60,6 +60,18 @@ steps: when: - event: push + - name: test-pyswiss + image: python:3.13-slim + environment: + SWISSEPH_PATH: /tmp/ephe + commands: + - apt-get update -qq && apt-get install -y -q gcc g++ + - pip install -r pyswiss/requirements.txt + - cd ./pyswiss + - python manage.py test apps.charts + when: + - event: push + - name: screendumps image: gitea.earthmanrpg.me/discoman/python-tdd-ci:latest commands: diff --git a/pyswiss/core/settings.py b/pyswiss/core/settings.py index 147828a..2b0cda4 100644 --- a/pyswiss/core/settings.py +++ b/pyswiss/core/settings.py @@ -3,9 +3,9 @@ from pathlib import Path BASE_DIR = Path(__file__).resolve().parent.parent -SECRET_KEY = 'pyswiss-dev-only-key-replace-in-production' -DEBUG = True -ALLOWED_HOSTS = ['*'] +SECRET_KEY = os.environ.get('SECRET_KEY', 'pyswiss-dev-only-key-replace-in-production') +DEBUG = os.environ.get('DEBUG', 'true').lower() != 'false' +ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '*').split(',') INSTALLED_APPS = [ 'django.contrib.contenttypes', diff --git a/pyswiss/requirements.txt b/pyswiss/requirements.txt index 619c8e3..8c784d9 100644 --- a/pyswiss/requirements.txt +++ b/pyswiss/requirements.txt @@ -1,2 +1,3 @@ django==6.0.4 +gunicorn==23.0.0 pyswisseph==2.10.3.2 diff --git a/src/core/settings.py b/src/core/settings.py index 200b039..b09617e 100644 --- a/src/core/settings.py +++ b/src/core/settings.py @@ -221,6 +221,9 @@ MAILGUN_DOMAIN = "howdy.earthmanrpg.com" # Your Mailgun domain STRIPE_PUBLISHABLE_KEY = os.environ.get("STRIPE_PUBLISHABLE_KEY", "") STRIPE_SECRET_KEY = os.environ.get("STRIPE_SECRET_KEY", "") +# PySwiss ephemeris microservice +PYSWISS_URL = os.environ.get("PYSWISS_URL", "http://127.0.0.1:8001") + if 'test' in sys.argv: import shutil _cache_dir = BASE_DIR / 'static' / 'CACHE'