Fix AI calls failing in Docker with empty OPENAI_BASE_URL

docker compose passes an empty .env line as OPENAI_BASE_URL="", and with
base_url=None the openai SDK fell back to that empty value, so every
call failed with "Connection error". Always pass the base URL
explicitly. Also disable gunicorn's unused control socket, which
logged a permission error because /app is read-only for the app user.

Found while deploying to the homelab server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Kyle Dammann
2026-10-30 22:37:39 +01:00
co-authored by Claude Opus 5.5
parent dfa4813a42
commit 015a0a5821
3 changed files with 20 additions and 3 deletions
+4 -2
View File
@@ -5,11 +5,13 @@ python manage.py migrate --noinput
python manage.py ensure_admin
python manage.py purge_ratelimits
# Forwarded headers are evaluated by core.middleware.ProxyMiddleware (TRUSTED_PROXIES),
# not by gunicorn, so gunicorn keeps its default of trusting none of them from remote peers.
# The control socket (gunicorn >= 26) is not used and /app is read-only for the app user.
exec gunicorn config.wsgi:application \
--bind 0.0.0.0:8000 \
--workers "${GUNICORN_WORKERS:-2}" \
--threads "${GUNICORN_THREADS:-4}" \
--timeout "${GUNICORN_TIMEOUT:-120}" \
--no-control-socket \
--access-logfile -
# Forwarded headers are evaluated by core.middleware.ProxyMiddleware (TRUSTED_PROXIES),
# not by gunicorn, so gunicorn keeps its default of trusting none of them from remote peers.