Skip to content
Snippets Groups Projects
Makefile 1.25 KiB
Newer Older
Jules Saget's avatar
Jules Saget committed
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: migrate
migrate: ## Make and run migrations
	$(PYTHON) $(MANAGER) makemigrations
	$(PYTHON) $(MANAGER) migrate

.PHONY: serve
serve: ## Run the django server
	$(PYTHON) $(MANAGER) runserver

.PHONY: start
start: install 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
test: ## Tests all the apps
	$(PYTHON) $(MANAGER) test
Dorian Lesbre's avatar
Dorian Lesbre committed

.PHONY: adduser
adduser: ## Create a new superuser
	$(PYTHON) $(MANAGER) createsuperuser

.PHONY: shell
shell: ## Run django's shell
	$(PYTHON) $(MANAGER) shell

.PHONY: static
static: ## collect static files
	$(PYTHON) $(MANAGER) collectstatic

.PHONY: preprod
preprod: test static ## Prepare and check production
	$(PYTHON) $(MANAGER) check --deploy