-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
147 lines (103 loc) · 2.91 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
ifneq (,$(wildcard ./.env))
include .env
endif
DCO=docker compose
RUNDJANGO=${DCO} run --rm web
UP=${DCO} up -d
EXEC=${DCO} exec
DJMANAGE=$(RUNDJANGO) python manage.py
compile-requirements-prod:
${RUNDJANGO} pip-compile pyproject.toml -o requirements.txt
compile-requirements-dev:
${RUNDJANGO} pip-compile --all-extras pyproject.toml -o requirements-dev.txt
update-requirements-prod:
${RUNDJANGO} pip-compile --upgrade pyproject.toml -o requirements.txt
update-requirements-dev:
${RUNDJANGO} pip-compile --upgrade --all-extras pyproject.toml -o requirements-dev.txt
compile-requirements: compile-requirements-prod compile-requirements-dev
update-requirements: update-requirements-prod update-requirements-dev
fmt:
pre-commit run -a
remove:
${DCO} down -v --remove-orphans
down:
${DCO} down
mypy:
${RUNDJANGO} mypy .
start:
${DCO} up -d
build:
${DCO} build web
restart:
${DCO} restart web
logs:
${DCO} logs -f --tail=50 web
pgcli:
${DCO} run --rm web pgcli ${DATABASE_URL}
psql:
${DCO} run --rm python manage.py dbshell
dbshell:
$(DJMANAGE) dbshell
messages:
$(DJMANAGE) makemessages --locale=es
compile-messages:
$(DJMANAGE) compilemessages
collectstatic:
${DCO} exec web python manage.py collectstatic --no-input --settings=${DJANGO_SETTINGS_MODULE}
stop:
${DCO} stop
ps:
${DCO} ps
clean: stop
${DCO} rm --force -v
test:
${DCO} run --rm web coverage run -m pytest
show-coverage:
${DCO} run --rm web coverage combine; ${DCO} run --rm web coverage report
check:
${DCO} run --rm web python manage.py check --settings=website.settings.prod --deploy
dockershell:
${DCO} run --rm web bash
show-migrations:
$(DJMANAGE) showmigrations
superuser:
$(DJMANAGE) createsuperuser
migrate:
$(DJMANAGE) migrate
migrations:
$(DJMANAGE) makemigrations
shell-plus:
$(DJMANAGE) shell_plus
shell-plus-sql:
$(DJMANAGE) shell_plus --print-sql
clear-cache:
$(DJMANAGE) clear_cache
show-urls:
${DCO} run --rm web python manage.py show_urls
apply-styles:
${DCO} run --rm web python manage.py apply_styles
clean-python: clean-build clean-pyc
clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
hard-clean-python: clean-build clean-pyc
.PHONY: help start stop ps clean test dockershell shell_plus only_test pep8
help:
@echo "help -- print this help"
@echo "start -- start docker stack"
@echo "stop -- stop docker stack"
@echo "ps -- show status"
@echo "build -- build image"
@echo "clean -- clean all artifacts"
@echo "test -- run tests using docker"
@echo "dockershell -- run bash inside docker"
@echo "shell_plus -- run web shell_plus inside docker"
@echo "bootstrap --build containers, run web migrations, load fixtures and create the a superuser"