-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
50 lines (39 loc) · 1.69 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
DATABASE_HOST?=127.0.0.1
DATABASE_PORT?=5432
DATABASE_USER?=postgres
DATABASE_NAME?=country_report
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z0-9_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
.init-db:
psql -h ${DATABASE_HOST} -p ${DATABASE_PORT} -U ${DATABASE_USER} -c "DROP DATABASE IF EXISTS test_${DATABASE_NAME}"
psql -h ${DATABASE_HOST} -p ${DATABASE_PORT} -U ${DATABASE_USER} -c "DROP DATABASE IF EXISTS ${DATABASE_NAME}"
psql -h ${DATABASE_HOST} -p ${DATABASE_PORT} -U ${DATABASE_USER} -c "CREATE DATABASE ${DATABASE_NAME}"
bootstrap:
python manage.py upgrade --admin-email [email protected] --admin-password 123
i18n:
./manage.py makemessages --locale es --locale fr --locale ar --locale pt --ignore '~*'
./manage.py compilemessages
test:
docker compose -f compose.test.yml down
docker compose -f compose.test.yml build
docker compose -f compose.test.yml up --build --exit-code-from backend
reset-migrations: ## reset django migrations
./manage.py check
find src -name '0*[1,2,3,4,5,6,7,8,9,0]*' | xargs rm -f
$(MAKE) .init-db
./manage.py makemigrations
gsed -i 's;operations = \[;operations = \[CITextExtension(),;' src/hope_country_report/apps/core/migrations/0001_initial.py
gsed -i '1i from django.contrib.postgres.operations import CITextExtension' src/hope_country_report/apps/core/migrations/0001_initial.py
isort src/hope_country_report/apps/core/migrations/0001_initial.py
black src/hope_country_report/apps/core/migrations/0001_initial.py
$(MAKE) bootstrap
python manage.py demo