add make targets for some manage.py tasks

This commit is contained in:
Lexi / Zoe 2019-10-21 02:13:01 +02:00
parent 0fdf7029e4
commit 2e3be76e31
Signed by: binaryDiv
GPG Key ID: F8D4956E224DA232
3 changed files with 18 additions and 2 deletions

View File

@ -18,6 +18,9 @@ RUN apk add --virtual build-deps gcc python3-dev musl-dev && \
COPY . .
# Create symlink to manage.py script in PATH
RUN ln -s /usr/src/app/manage.py /usr/local/bin/manage.py
EXPOSE 8000
CMD ["gunicorn", "pluralityspace.wsgi:application", \

View File

@ -9,8 +9,9 @@ SERVER_LISTEN ?= 0.0.0.0:8042
STAGE ?= production
GIT_CRYPT_KEY ?= ~/.git-crypt-keys/$(APP_NAME)-$(STAGE).key
DOCKER_COMPOSE_YML := .deployment/$(STAGE)/docker-compose.yml
APP_CONTAINER_NAME := django
.PHONY: run docker-build docker-run decrypt deploy log-show
.PHONY: run docker-build docker-run decrypt deploy log-show live-collectstatic live-migrate live-shell
# Default target: none
all:
@ -44,3 +45,15 @@ deploy:
# Show logs for running container
log-show:
docker-compose -f $(DOCKER_COMPOSE_YML) logs -f
# Run django 'collectstatic' command on live container
live-collectstatic:
docker-compose -f $(DOCKER_COMPOSE_YML) exec ${APP_CONTAINER_NAME} manage.py collectstatic --no-input --clear
# Run django 'migrate' command on live container
live-migrate:
docker-compose -f $(DOCKER_COMPOSE_YML) exec ${APP_CONTAINER_NAME} manage.py migrate --no-input
# Run shell in live container
live-shell:
docker-compose -f $(DOCKER_COMPOSE_YML) exec ${APP_CONTAINER_NAME} sh

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""Django's command-line utility for administrative tasks."""
import os
import sys