Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Django & Postgres with docker-compose.

Notifications You must be signed in to change notification settings

lfir/django-postgres-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Development environment for Django projects that uses docker-compose and PostgreSQL.

Interactive shell commands

  • Open psql
docker exec -it containerID psql -U postgres
  • Access Django's shell
docker exec -w /prj/projectName -it containerID python manage.py shell
  • Create admin user
docker exec -w /prj/projectName -it containerID python manage.py createsuperuser

Non-interactive shell commands

  • Create a new Django project
docker-compose run -w /prj --rm --u uid:gid django django-admin startproject projectName
  • Create migration file
docker-compose run -w /prj/projectName --rm django python manage.py makemigrations appName
  • Run migrate
docker-compose run -w /prj/projectName --rm django python manage.py migrate appName
  • Run startapp
docker-compose run -w /prj/projectName --rm django python manage.py startapp appName