-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
80 lines (57 loc) · 1.44 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
VENV_NAME := env
VENV = . env/bin/activate &&
MANAGE = python app/manage.py
##########
# DOCKER #
##########
build-dev:
docker compose --env-file .env.dev -f docker/compose.yaml build --build-arg PLATFORM=dev
build-prod:
docker compose --env-file .env.prod -f docker/compose.yaml build --build-arg PLATFORM=prod
up-dev:
docker compose --env-file .env.dev -f docker/compose.yaml up -d --no-build
up-prod:
docker compose --env-file .env.prod -f docker/compose.yaml up -d --no-build
#########
# LOCAL #
#########
venv:
if [ ! -d $(VENV_NAME) ]; then \
python -m venv $(VENV_NAME); \
fi
install: venv
$(VENV) pip install -U pip
$(VENV) pip install -r requirements/dev.txt
migrations: venv
$(VENV) $(MANAGE) makemigrations
migrate: venv
$(VENV) $(MANAGE) migrate
superuser: venv
$(VENV) DJANGO_SUPERUSER_USERNAME=django \
DJANGO_SUPERUSER_PASSWORD=django \
DJANGO_SUPERUSER_EMAIL="django@example.org" \
$(MANAGE) createsuperuser --noinput
runserver: venv
$(VENV) $(MANAGE) runserver 8002
shell: venv
$(VENV) $(MANAGE) shell
command: venv
$(VENV) $(MANAGE) create_thumbnails
test: venv
$(VENV) PYTHONPATH=$PYTHONPATH:app/ pytest --maxfail=1 --exitfirst
init: install migrate superuser
start: runserver
##########
# FORMAT #
##########
check:
$(VENV) ruff check
isort:
$(VENV) ruff check --select I --fix
format:
$(VENV) ruff check --select I --fix && ruff format
#############
# API TESTS #
#############
apitest:
sh scripts/apitest.sh