forked from ConoscereLinux/django-conoscerelinux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
83 lines (65 loc) · 1.93 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
VENV=.venv
SHELL=/bin/bash
DJANGO_PROJECT=clinux
SYSPYTHON?=python3
python=$(VENV)/bin/python3
pip=$(python) -m pip
django=$(python) $(DJANGO_PROJECT)/manage.py
# Utility scripts to prettify echo outputs
bold := '\033[1m'
sgr0 := '\033[0m'
.PHONY: init
init: venv update
.PHONY: clean
clean:
@echo -e $(bold)Clean up old virtualenv and cache$(sgr0)
rm -rf $(VENV) *.egg-info
.PHONY: venv
venv: clean
@echo -e $(bold)Create virtualenv$(sgr0)
$(SYSPYTHON) -m venv $(VENV)
$(pip) install --upgrade pip pip-tools
.PHONY: update
update:
@echo -e $(bold)Install and update requirements$(sgr0)
$(python) -m piptools sync
.PHONY: requirements
requirements:
@$(python) -m piptools compile -vU --all-extras \
--resolver backtracking --output-file requirements.txt pyproject.toml
.PHONY: test
test:
$(python) -m pytest -x -p no:warnings
.PHONY: lint
lint:
$(python) -m black $(DJANGO_PROJECT)
$(python) -m isort $(DJANGO_PROJECT)
.PHONY: secret-key
secret-key:
$(python) -c 'from django.core.management.utils import get_random_secret_key; print(f"SECRET_KEY=\"{get_random_secret_key()}\"")' > .env
.PHONY: migrate migrations
migrate:
$(django) migrate
migrations:
$(django) makemigrations
superuser:
$(django) createsuperuser --username admin
.PHONY: serve runserver
serve: runserver
runserver:
$(django) runserver
.PHONY: db
db:
rm $(DJANGO_PROJECT)/db.sqlite3
$(django) migrate
.PHONY: demo
demo:
$(django) loaddata authentication/demo members/demo events/demo pages/demo
.PHONY: fixtures
fixtures:
$(django) dumpdata members --indent 2 > $(DJANGO_PROJECT)/members/fixtures/members/demo.json
$(django) dumpdata events --indent 2 > $(DJANGO_PROJECT)/events/fixtures/events/demo.json
$(django) dumpdata authentication --indent 2 > $(DJANGO_PROJECT)/authentication/fixtures/authentication/demo.json
$(django) dumpdata pages --indent 2 > $(DJANGO_PROJECT)/pages/fixtures/pages/demo.json
.PHONY: kamehameha
kamehameha: init migrations db demo