Newer
Older
SHELL := /bin/bash
PYTHON := python3
MANAGER := manage.py
DB := db.sqlite3
@echo "make: list of useful targets :"
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\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" -not -path "*/venv/*" -delete
find . -path "*/migrations/*.pyc" -not -path "*/venv/*" -delete
$(PYTHON) $(MANAGER) collectstatic
.PHONY: preprod
preprod: test static ## Prepare and check production
$(PYTHON) $(MANAGER) check --deploy