Skip to content

Commit

Permalink
Merge branch 'main' into date-it
Browse files Browse the repository at this point in the history
  • Loading branch information
icicel committed Sep 5, 2024
2 parents 52ccbd0 + 50fa8fe commit 3b96f78
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
29 changes: 12 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
5 changes: 4 additions & 1 deletion docker-compose.develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions scripts/boot.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3b96f78

Please sign in to comment.