Created
August 21, 2020 00:10
-
-
Save cweedall/e20f91729b3dccfbbaa7a0acc81cb233 to your computer and use it in GitHub Desktop.
Method to use `migrate` and `makemigrations` commands in Django which is running in Docker container (via docker-compose)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assume django in container named web | |
# Use `python3` instead of `python` if necessary | |
docker-compose run web python manage.py migrate | |
docker-compose run web python manage.py makemigrations APP_NAME | |
####################################################### | |
### example docker-compose.yaml file | |
####################################################### | |
version: '3' | |
services: | |
db: | |
image: postgres | |
web: | |
build: . | |
command: python manage.py runserver 0.0.0.0:8000 | |
volumes: | |
- .:/code | |
ports: | |
- "8000:8000" | |
depends_on: | |
- db | |
####################################################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment