diff --git a/.env.template b/.env.template index 5291aa8..d2f94fc 100644 --- a/.env.template +++ b/.env.template @@ -1,15 +1,16 @@ # Django DJANGO_SETTINGS_MODULE=website.settings -DJANGO_SECRET_KEY=test_key +DJANGO_SECRET_KEY=CWHZCAZBNV57tDkwGHJwTUu3PCSnGG45 DEBUG=TRUE ALLOWED_HOSTS=localhost # Database (PostgreSQL) -POSTGRES_DB=test_db POSTGRES_USER=test_user POSTGRES_PASSWORD=test_password POSTGRES_HOST=db POSTGRES_PORT=5432 +POSTGRES_DBNAME=test_dbname # == POSTGRES_DB +POSTGRES_DB=test_db # Gunicorn GUNICORN_WORKERS=3 diff --git a/Makefile b/Makefile index f765310..31b7e19 100644 --- a/Makefile +++ b/Makefile @@ -7,4 +7,4 @@ dev: docker compose -f ./compose.yaml -f ./compose.dev.yaml up --build test: - docker compose -f ./compose.yaml -f ./compose.test.yaml up --build + docker compose -f ./compose.yaml -f ./compose.test.yaml up --build --abort-on-container-exit --exit-code-from web diff --git a/compose.test.yaml b/compose.test.yaml index 9a2f52e..55a573d 100644 --- a/compose.test.yaml +++ b/compose.test.yaml @@ -1,9 +1,12 @@ services: web: - env_file: .env.template + env_file: + - .env.template command: python -Wa manage.py test --noinput --parallel + restart: "no" db: - env_file: .env.template + env_file: + - .env.template diff --git a/src/website/settings.py b/src/website/settings.py index 96543e2..7a4d735 100644 --- a/src/website/settings.py +++ b/src/website/settings.py @@ -26,7 +26,7 @@ SECRET_KEY = "django-insecure-c$q7wdq+u@ow74wp!&zzkxdylkueu)(+34e%!e0du&bjwoqz9z # SECURITY WARNING: don't run with debug turned on in production! DEBUG = bool(os.getenv("DEBUG")) -ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS").split(",") +ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS").split(",") SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") @@ -77,7 +77,7 @@ WSGI_APPLICATION = "website.wsgi.application" DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", - "NAME": os.getenv("POSTGRES_NAME"), + "DBNAME": os.getenv("POSTGRES_DBNAME"), "USER": os.getenv("POSTGRES_USER"), "PASSWORD": os.getenv("POSTGRES_PASSWORD"), "HOST": os.getenv("POSTGRES_HOST"),