-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (31 loc) · 875 Bytes
/
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
ENV = env
PYTHON = $(ENV)/bin/python
PIP = $(ENV)/bin/pip
DJANGO_MANAGE = $(PYTHON) manage.py
AWS_REGION ?= us-east-1
# Make postgres available
docker-up:
docker compose up --build --force-recreate
# Apply database migrations
migrate:
$(DJANGO_MANAGE) migrate
# Run the Django development server
run:
$(DJANGO_MANAGE) runserver
# Run unit tests
test:
$(DJANGO_MANAGE) test
# Clean up the environment
clean:
rm -rf $(ENV)
# Build for production
build-local:
docker build -t django-app:latest .
# Run the application in a container (works for both windows and linux)
run-container:
docker run -e DB_HOST=host.docker.internal -p 8000:8000 --add-host=host.docker.internal:host-gateway django-app
# Set up the application (install, migrate, seed)
setup: docker-up migrate
# Run server and watch the logs
run_with_logs:
$(DJANGO_MANAGE) runserver | tee server.log