-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
90 lines (73 loc) · 2.28 KB
/
justfile
File metadata and controls
90 lines (73 loc) · 2.28 KB
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
export COMPOSE_FILE := "docker-compose.local.yml"
# Note that if you are running these commands without just, you will need to run the above command
# in your terminal before running any of the commands below, or add "-f docker-compose.local.yml" to
# the docker compose commands after the word "compose".
# List all available commands
default:
@just --list
# Build python image
[group("compose")]
build:
@echo "Building python image..."
@docker compose build
# Start up containers
[group("compose")]
up:
@echo "Starting up containers..."
@docker compose up -d --remove-orphans
# Stop containers
[group("compose")]
down:
@echo "Stopping containers..."
@docker compose down
# Remove containers and their volumes
[group("compose")]
prune *args:
@echo "Killing containers and removing volumes..."
@docker compose down -v {{ args }}
# View container logs
[group("compose"), group("docker")]
logs *args:
@docker compose logs -f {{ args }}
# Lint staged changes
[group("docker"), group("testing")]
lint *args:
@docker compose exec django pre-commit run {{ args }}
# Run a command in the Django container
[group("docker")]
run +cmd:
@docker compose exec django {{ cmd }}
# Open a shell in the Django container
[group("docker")]
shell +container="django":
@docker compose run --rm {{ container }} bash
# Executes `manage.py` command
[group("management")]
manage +args:
@docker compose run --rm django python ./manage.py {{ args }}
# Make and apply database migrations
[group("management")]
migrate: (manage "makemigrations") (manage "migrate")
# Load initial data into the database
[group("management")]
loaddata +filename="democrasite social": (manage "loaddata" filename)
# Create a superuser account
[group("management")]
createsuperuser: (manage "createsuperuser")
# Open a Python shell in the Django container
[group("management")]
pyshell: (manage "shell_plus")
# Run tests.
[group("testing")]
test *args:
@docker compose run --rm django pytest {{ args }}
# Run tests and open coverage report
[group("testing")]
coverage:
-docker compose run --rm django coverage run -m pytest
@docker compose exec django coverage html
@open ./htmlcov/index.html
# Run type checks
[group("testing")]
typecheck:
@docker compose exec django mypy democrasite