Newer
Older
SHELL := /bin/bash
PYTHON := python3
MANAGER := manage.py
DB := db.sqlite3
.PHONY: help
help: ## Show this help
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: install
install: ## Install requirements
$(PYTHON) -m pip install --upgrade pip
pip install -r requirements.txt
.PHONY: secret
secret: ## Link the secret_example.py to secret.py (only in dev mode)
secret $(SECRET):
ln -s "$(PWD)/interludes/secret_example.py" interludes/secret.py
$(PYTHON) $(MANAGER) makemigrations
$(PYTHON) $(MANAGER) migrate
.PHONY: serve
host: $(SECRET) ## Host localy to access from same netword (make sure to add IP to ALLOWED_HOSTS)
$(PYTHON) $(MANAGER) runserver 0.0.0.0:8000
start: install $(SECRET) migrate serve ## Install requirements, apply migrations, then start development server
.PHONY: clean
clean: ## Remove migrations and delete database
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
find . -path "*/migrations/*.pyc" -delete
rm $(DB)
.PHONY: test
$(PYTHON) $(MANAGER) collectstatic
.PHONY: preprod
preprod: test static ## Prepare and check production
$(PYTHON) $(MANAGER) check --deploy