Skip to content

Commit

Permalink
Renamed variables for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-Crow committed Nov 21, 2023
1 parent f689233 commit e14a0fd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
6 changes: 4 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
SECRET_KEY=
DEBUG=False
HOST_PROTO=http
HOST_URL="localhost, 0.0.0.0"
HOST_URL="0.0.0.0"
HOST_ALLOWED_URLS="localhost, 0.0.0.0"
HOST_PORT=8000

USE_VENV=1
USE_DOCKER=0 # Set 1 to use Docker

DATABASE_NAME=djdb
DATABASE_USER=dju
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ jobs:
make test-unit
env:
DJANGO_DEBUG: True
USE_VENV: 1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ USER app

ENTRYPOINT ["./entrypoint.sh"]

CMD ["poetry", "run", "python", "manage.py", "runserver", "0.0.0.0:8000"]
CMD ["poetry", "run", "python", "manage.py", "runserver", "0.0.0.0:${HOST_PORT}"]
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ifeq ($(USE_VENV),1)
EXEC_CMD :=
else
ifeq ($(USE_DOCKER),1)
EXEC_CMD := docker-compose exec -ti web
else
EXEC_CMD :=
endif

.PHONY: web-prompt
Expand Down
6 changes: 3 additions & 3 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True if os.getenv("DEBUG") == "True" else False

HOST_URL = os.getenv("HOST_URL", "127.0.0.1, localhost")
HOST_ALLOWED_URLS = os.getenv("HOST_ALLOWED_URLS", "127.0.0.1, localhost")

ALLOWED_HOSTS = HOST_URL.replace(" ", "").split(",")
ALLOWED_HOSTS = HOST_ALLOWED_URLS.replace(" ", "").split(",")

# Application definition

Expand Down Expand Up @@ -195,7 +195,7 @@

# Base URL to use when referring to full URLs within the Wagtail admin backend -
# e.g. in notification emails. Don't include '/admin' or a trailing slash
WAGTAILADMIN_BASE_URL = f"{os.getenv('HOST_PROTO', 'https')}://{HOST_URL[-1]}"
WAGTAILADMIN_BASE_URL = f"{os.getenv('HOST_PROTO', 'https')}://{os.getenv('HOST_URL', 'localhost')}"

# Disable Gravatar service
WAGTAIL_GRAVATAR_PROVIDER_URL = None
Expand Down
14 changes: 7 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ services:
db:
image: postgres:14.5-alpine
environment:
POSTGRES_USER: dju
POSTGRES_PASSWORD: djpwd
POSTGRES_DB: djdb
PGPORT: 8432
POSTGRES_USER: ${DATABASE_USER}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
POSTGRES_DB: ${DATABASE_NAME}
PGPORT: ${DATABASE_PORT}
ports:
- "8432:8432"
- "${DATABASE_PORT}:${DATABASE_PORT}"
volumes:
- postgres_data:/var/lib/postgresql/data

web:
build: .
environment:
DATABASE_URL: postgres://dju:djpwd@db:8432/djdb
DATABASE_URL: postgres://${DATABASE_USER}:${DATABASE_PASSWORD}@db:${DATABASE_PORT}/${DATABASE_NAME}
ports:
- "8000:8000"
- "${HOST_PORT}:${HOST_PORT}"
volumes:
- .:/app
depends_on:
Expand Down

0 comments on commit e14a0fd

Please sign in to comment.