diff --git a/Makefile b/Makefile index ab4fcb1..f75448e 100644 --- a/Makefile +++ b/Makefile @@ -5,26 +5,21 @@ export $(shell sed 's/=.*//' .env) test: env -# delete this -up-prod: - sudo -E docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d - sudo -E docker-compose exec web /bin/sh -c "python3 manage.py migrate" - sudo -E docker-compose exec web /bin/sh -c "python3 manage.py compilemessages -l en" - sudo -E docker-compose exec web /bin/sh -c "python3 manage.py collectstatic --noinput" - -# delete this too up-develop: # sleep 5 && sudo docker-compose exec web /bin/sh -c "python3 manage.py migrate" & - sudo -E docker-compose run web /bin/sh -c "python3 manage.py compilemessages -l en" - sudo -E docker-compose -f docker-compose.yml -f docker-compose.develop.yml up - -refreshdb: - sudo -E docker compose exec web python3 manage.py migrate + docker compose run web /bin/sh -c "python3 manage.py compilemessages -l en" + docker compose -f docker-compose.yml -f docker-compose.develop.yml up makemessages: - sudo -E docker compose exec web python3 manage.py makemessages -a - sudo -E docker compose cp web:/locale . + docker compose exec web python3 manage.py makemessages -a + docker compose cp web:/locale . compilemessages: - sudo -E docker compose cp ./locale web:. - sudo -E docker compose exec web python3 manage.py compilemessages + docker compose cp ./locale web:. + docker compose exec web python3 manage.py compilemessages + +build: + docker compose build + +down: + docker compose down diff --git a/README.md b/README.md index 43cea93..360435e 100644 --- a/README.md +++ b/README.md @@ -162,5 +162,6 @@ parameter in the url as defined in `urls.py`. The website is written with Swedish as its original language. In order to make a string translatable, it must be wrapped in a function. For details on how to do this in pyton code and template code respectively, see the [Django docs on translation](https://docs.djangoproject.com/en/2.1/topics/i18n/translation/). -The mapping from Swedish to English lives in `locale/en/LC_MESSAGES/django.po -`. When you have edited a file and added strings that need to be created, run `make makemessages`. This will update the .po file to contain the new strings, whose translation can now be filled in. For the website to update, you need to compile the .po file. This can be done by running `make compilemessages`. If this does not work, try stopping the container using `make down` and starting it up again; the makefile is configured to compile the messages as the container starts. +The mapping from Swedish to English lives in `locale/en/LC_MESSAGES/django.po`. When you have edited a file and added strings that need to be created, run `make makemessages`. This will update the .po file to contain the new strings, whose translations can now be filled in. Any translation strings that have been marked as "fuzzy" will be ignored by Django, so make sure to clean those up before finishing. + +For the website to update, you need to compile the .po file. This can be done by running `make compilemessages`. If this does not work, try stopping the container using `make down` and starting it up again; the makefile is configured to compile the messages as the container starts. diff --git a/docker-compose.develop.yml b/docker-compose.develop.yml index 8bc1ee5..ea93f3a 100644 --- a/docker-compose.develop.yml +++ b/docker-compose.develop.yml @@ -3,8 +3,11 @@ version: '3.7' services: web: # use wait for it script to make sure db is ready before launching - command: ["/scripts/wait-for-it.sh", "db:5432", "--", "python", "manage.py", "runserver", "0.0.0.0:8000"] + command: ["/scripts/boot.sh"] + ports: + - "8000:8000" volumes: - ./dtekportal:/code + - ./scripts:/scripts environment: - DJANGO_DEBUG=1 diff --git a/scripts/boot.sh b/scripts/boot.sh new file mode 100755 index 0000000..78aeec1 --- /dev/null +++ b/scripts/boot.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +python3 manage.py migrate +python3 manage.py compilemessages +exec /scripts/wait-for-it.sh db:5432 -- python manage.py runserver 0.0.0.0:8000