-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (57 loc) · 1.84 KB
/
Copy pathMakefile
File metadata and controls
76 lines (57 loc) · 1.84 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
# Load .env into the environment if it exists.
ifneq (,$(wildcard .env))
include .env
export
endif
VENV := .venv
PY := $(VENV)/bin/python
.PHONY: dev test test-verbose migrate makemigrations lint format typecheck hooks pre-commit shell superuser check venv install collectstatic deploy
venv:
python3 -m venv $(VENV)
install: venv
$(VENV)/bin/pip install uv
$(VENV)/bin/uv pip install -e ".[dev]"
@if [ ! -f .env ]; then \
cp .env.example .env; \
python3 -c "import secrets; key=secrets.token_urlsafe(50); data=open('.env').read(); open('.env','w').write(data.replace('SECRET_KEY=changeme','SECRET_KEY='+key))"; \
echo "Created .env with a generated SECRET_KEY"; \
fi
dev:
$(PY) manage.py migrate --run-syncdb
@# NOTE: NO --reload here. uvicorn --reload restarts the worker on
@# file save, dropping LiveView WebSocket state — symptom: the page
@# flashes the new design then snaps back to the old one as the
@# client reconnects against cached old VDOM. djust's Hot View
@# Replacement (HVR) auto-enables when DEBUG=True and watchdog is
@# installed (in [project.optional-dependencies].dev) and preserves
@# form input, scroll position, and view state across reloads.
@# Look for "[HotReload] Hot reload enabled..." in startup logs.
$(VENV)/bin/uvicorn config.asgi:application --host 0.0.0.0 --port 8000
test:
$(VENV)/bin/pytest
test-verbose:
$(VENV)/bin/pytest -v
migrate:
$(PY) manage.py migrate
makemigrations:
$(PY) manage.py makemigrations
lint:
$(VENV)/bin/ruff check .
format:
$(VENV)/bin/ruff format .
typecheck:
$(VENV)/bin/mypy
hooks:
$(VENV)/bin/pre-commit install
pre-commit:
$(VENV)/bin/pre-commit run --all-files
shell:
$(PY) manage.py shell
superuser:
$(PY) manage.py createsuperuser
check:
$(PY) manage.py check
collectstatic:
$(PY) manage.py collectstatic --noinput
deploy:
$(VENV)/bin/djust deploy