generated from AvishrantsSh/Django-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (39 loc) · 1.18 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
PYTHON_EXE?=python3
MANAGE=bin/python manage.py
ACTIVATE?=. bin/activate;
VIRTUALENV_PYZ=etc/virtualenv.pyz
GET_SECRET_KEY=`base64 /dev/urandom | head -c50`
ENV_FILE=.env
# Default Django Port
PORT = 8000
virtualenv:
@echo "-> Making Virtual Environment"
@${PYTHON_EXE} ${VIRTUALENV_PYZ} --never-download --no-periodic-update .
install: virtualenv
@echo "-> Generating Secret key"
@if test -f ${ENV_FILE}; then echo ".env file exists already"; true; fi
@mkdir -p $(shell dirname ${ENV_FILE}) && touch ${ENV_FILE}
@echo SECRET_KEY=\"${GET_SECRET_KEY}\" > ${ENV_FILE}
@echo "-> Installing Dependencies"
@${ACTIVATE} pip install -r etc/requirements.txt
project: install
@echo -n "-> Enter Project Name: ";\
read PROJECT; \
django-admin startproject --template=./etc/structure $${PROJECT} .
migrate:
@echo "-> Apply database migrations"
${MANAGE} makemigrations
${MANAGE} migrate
run:
${MANAGE} runserver ${PORT}
freeze:
@echo "-> Updating Project Requirements"
@${ACTIVATE} pip freeze > etc/requirements.txt
flush:
@echo "-> Flushing Database"
${MANAGE} flush
format:
@echo "-> Run isort imports ordering validation"
@isort --gitignore .
@echo "-> Run black validation"
@black .