From 86ee2172d389cbf0ab219847bd2c78a60b686be7 Mon Sep 17 00:00:00 2001 From: jnfire Date: Mon, 1 Aug 2022 15:52:14 +0200 Subject: [PATCH] fix variables fix variables --- Caddyfile.dev | 18 ++++++++++++++++++ Caddyfile => Caddyfile.pro | 2 +- Makefile | 8 ++++---- README.md | 24 ++++++++++++------------ docker-compose.dev.yaml | 3 +-- docker-compose.pro.yaml | 3 +-- scripts/__ini__.py | 0 test/__ini__.py | 0 test/test_start.py | 4 ++++ 9 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 Caddyfile.dev rename Caddyfile => Caddyfile.pro (85%) create mode 100644 scripts/__ini__.py create mode 100644 test/__ini__.py create mode 100644 test/test_start.py diff --git a/Caddyfile.dev b/Caddyfile.dev new file mode 100644 index 0000000..8d9c458 --- /dev/null +++ b/Caddyfile.dev @@ -0,0 +1,18 @@ +http://here.project.localhost { + + root * /usr/src/app/ + encode gzip zstd + + @notStatic { + not path /static/* /media/* + } + + reverse_proxy @notStatic django:8000 + + file_server /static/* + file_server /media/* +} + +http://webmail.localhost { + reverse_proxy mailhog:8025 +} diff --git a/Caddyfile b/Caddyfile.pro similarity index 85% rename from Caddyfile rename to Caddyfile.pro index d883b6d..5122434 100644 --- a/Caddyfile +++ b/Caddyfile.pro @@ -1,4 +1,4 @@ -{$DOMAIN_URL} +https://here.project root * /usr/src/app/ diff --git a/Makefile b/Makefile index 6646f18..befa457 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,11 @@ help: @perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}' -lint: ## Check style with black - black --check --exclude="/(postgres|venv|migrations|\.git)/" . - format: ## Format style with black - black --exclude="/(postgres|venv|migrations|\.git)/" . + black --exclude="/(postgres_data|venv|migrations|\.git)/" core/ apps/ scripts/ tests/ + +test: ## Tests + docker-compose -f docker-compose.dev.yaml exec -T django bash -c "pytest" docker.recreate.django: ## Recreate Django image docker-compose -f docker-compose.dev.yaml build --no-cache --force-rm django diff --git a/README.md b/README.md index df07dd6..e40453a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ make run.server Now open: -`http://template.localhost` +`http://here.project.localhost` ## Gulp @@ -68,15 +68,15 @@ make run.loaddata.test ## Other domains -- Caddy: `http://template.localhost`. -- Gulp: `http://template.localhost:3000`. -- Django: `http://template.localhost:8000`. -- Mailhog: `http://template.localhost:8025`. +- Caddy: `http://here.project.localhost`. +- Gulp: `http://here.project.localhost:3000`. +- Django: `http://here.project.localhost:8000`. +- Mailhog: `http://here.project.localhost:8025`. ### Bash Django ``` shell -docker exec -it template-django bash +docker exec -it here.project-django bash ``` # Run production @@ -89,14 +89,14 @@ Open `https://template.io`. # Enviroment (.env) ```text -PROJECT_NAME=template +PROJECT_NAME=here.project # Domain -DOMAIN=template.localhost -DOMAIN_URL=http://template.localhost +DOMAIN=here.project.localhost +DOMAIN_URL=http://here.project.localhost # Database -DB_NAME=template_db +DB_NAME=project_db DB_USER=postgres DB_PASSWORD=postgres DB_HOST=postgresql @@ -114,8 +114,8 @@ CADDY_PORT_ONE=80 CADDY_PORT_TWO=443 # Email -DEFAULT_FROM_EMAIL=no-reply@template.localhost -EMAIL_CONTACT=info@template.localhost +DEFAULT_FROM_EMAIL=no-reply@here.project.localhost +EMAIL_CONTACT=info@here.project.localhost EMAIL_HOST=mailhog EMAIL_USER= EMAIL_PASSWORD= diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index d0dd138..66c4fe9 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -26,7 +26,6 @@ services: DEBUG: "False" ALLOWED_HOSTS: ${DOMAIN} SECRET_KEY: ${DJANGO_SECRET_KEY} - DB_ENGINE: django.db.backends.postgresql DB_NAME: ${DB_NAME} DB_USER: ${DB_USER} DB_PASSWORD: ${DB_PASSWORD} @@ -60,7 +59,7 @@ services: - ${CADDY_PORT_ONE}:80 - ${CADDY_PORT_TWO}:443 volumes: - - ./Caddyfile:/etc/caddy/Caddyfile + - ./Caddyfile.dev:/etc/caddy/Caddyfile - ./caddy_data:/data - .:/usr/src/app/ depends_on: diff --git a/docker-compose.pro.yaml b/docker-compose.pro.yaml index 596024a..0bfe700 100644 --- a/docker-compose.pro.yaml +++ b/docker-compose.pro.yaml @@ -26,7 +26,6 @@ services: DEBUG: "False" ALLOWED_HOSTS: ${DOMAIN} SECRET_KEY: ${DJANGO_SECRET_KEY} - DB_ENGINE: django.db.backends.postgresql DB_NAME: ${DB_NAME} DB_USER: ${DB_USER} DB_PASSWORD: ${DB_PASSWORD} @@ -60,7 +59,7 @@ services: - ${CADDY_PORT_ONE}:80 - ${CADDY_PORT_TWO}:443 volumes: - - ./Caddyfile:/etc/caddy/Caddyfile + - ./Caddyfile.pro:/etc/caddy/Caddyfile - ./caddy_data:/data - .:/usr/src/app/ depends_on: diff --git a/scripts/__ini__.py b/scripts/__ini__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/__ini__.py b/test/__ini__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/test_start.py b/test/test_start.py new file mode 100644 index 0000000..6c9f592 --- /dev/null +++ b/test/test_start.py @@ -0,0 +1,4 @@ + +def test_hello_world(): + assert "hello_world" == "hello_world" + assert "foo" != "bar" \ No newline at end of file