-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
68 lines (54 loc) · 1.58 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
PYTHON_EXE?=python3
MANAGE=bin/python manage.py
ACTIVATE?=. bin/activate;
GET_SECRET_KEY=`base64 /dev/urandom | head -c50`
ENV_FILE=.env
# Default Django Port
PORT = 8000
virtualenv:
@echo "-> Getting Essential Build Files"
@sudo apt-get install python3-venv
@echo "-> Making Virtual Environment"
@${PYTHON_EXE} -m venv .
genkey: virtualenv
@echo "-> Generating Secret key"
@if test -f ${ENV_FILE}; then echo ".env file exists already"; true; else \
mkdir -p $(shell dirname ${ENV_FILE}) && touch ${ENV_FILE}; \
echo SECRET_KEY=\"${GET_SECRET_KEY}\" > ${ENV_FILE}; \
cat etc/env.txt >> ${ENV_FILE}; fi
install: genkey
@echo "-> Installing Dependencies"
@${ACTIVATE} pip install -r etc/base.txt
dev: genkey
@echo "-> Installing Dependencies"
@${ACTIVATE} pip install -r etc/dev.txt
project: dev
@echo -n "-> Enter Project Name: ";\
read PROJECT; \
${ACTIVATE} django-admin startproject --template=./etc/structure $${PROJECT} .
@echo "-> Clearing Redundant Files"
@rm -r etc/structure
migrate:
@echo "-> Apply database migrations"
${MANAGE} makemigrations
${MANAGE} migrate
run:
${MANAGE} runserver ${PORT}
flush:
@echo "-> Flushing Database"
${MANAGE} flush
format:
@echo "-> Run isort imports ordering validation"
@${ACTIVATE} isort --profile black --gitignore .
@echo "-> Run black validation"
@${ACTIVATE} black .
test:
@${MANAGE} test
check: test
@echo "-> Run black validation"
@${ACTIVATE} black --check .
coverage:
@echo "-> Generating coverage report"
@${ACTIVATE} coverage run --source='.' manage.py test
@${ACTIVATE} coverage report
@${ACTIVATE} coverage html