diff --git a/blechreiz/settings.py b/blechreiz/settings.py index 4e38710..a920b37 100644 --- a/blechreiz/settings.py +++ b/blechreiz/settings.py @@ -16,7 +16,8 @@ except ImportError: # Django settings for blechreiz project. -DEBUG = True +# Set DJANGO_DEBUG=True in .env for local development; leave unset (or False) in production. +DEBUG = os.environ.get("DJANGO_DEBUG", "False") == "True" ADMINS = [ ("Martin Bauer", "bauer_martin@gmx.de"), @@ -76,6 +77,9 @@ PUBLIC_URLS = ( "^musicians/login/?$", "^musicians/login/usernames/?$", "^eventplanner_gcal/gcalApiCallback*", + # Static and media files must be accessible without login + r"^static/", + r"^media/", ) # Additional locations of static files @@ -94,6 +98,8 @@ SECRET_KEY = os.environ["DJANGO_SECRET_KEY"] MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", + # WhiteNoise serves static files directly — must be right after SecurityMiddleware + "whitenoise.middleware.WhiteNoiseMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000..0c2e9a8 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + +cd /app + +echo "--- Installing/updating Python dependencies ---" +pip install --quiet -r requirements.txt + +echo "--- Collecting static files ---" +python manage.py collectstatic --noinput + +echo "--- Running database migrations ---" +python manage.py migrate --noinput + +echo "--- Starting gunicorn ---" +exec gunicorn blechreiz.wsgi:application \ + --bind 0.0.0.0:8000 \ + --workers 2 \ + --timeout 120 \ + --access-logfile - \ + --error-logfile - diff --git a/eventplanner/templates/eventplanner/countdown.inc.html b/eventplanner/templates/eventplanner/countdown.inc.html index 8313e8c..080033c 100644 --- a/eventplanner/templates/eventplanner/countdown.inc.html +++ b/eventplanner/templates/eventplanner/countdown.inc.html @@ -1,11 +1,11 @@ {% load sekizai_tags static %} {% addtoblock "css" strip %}{% endaddtoblock %} {% addtoblock "css" strip %}{% endaddtoblock %} {% if countdown %} {% addtoblock "js" %} diff --git a/eventplanner_gcal/templates/eventplanner_gcal/management.html b/eventplanner_gcal/templates/eventplanner_gcal/management.html index 86f520f..273b0dc 100644 --- a/eventplanner_gcal/templates/eventplanner_gcal/management.html +++ b/eventplanner_gcal/templates/eventplanner_gcal/management.html @@ -4,7 +4,7 @@ {% block content %} {% addtoblock "css" strip %} - + {% endaddtoblock %} {% addtoblock "css" %} @@ -25,7 +25,7 @@ {% endaddtoblock %} {% addtoblock "js" strip %} - + {% endaddtoblock %} {% addtoblock "js" %} @@ -72,7 +72,7 @@ weil man alle anderen eigenen Termine auch im Blick hat.
-
+
+