Содержание

[Шпаргалка] Django Cookiecutter commands

Содержание
Предупреждение
Последний раз данная статья обновлялась 15.04.2022, информация может быть устаревшей.
 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
pip install "cookiecutter>=1.7.0"

sudo docker-compose -f production.yml build
sudo docker-compose -f production.yml down
sudo docker-compose -f production.yml up -d
sudo docker-compose -f production.yml run --rm django python manage.py migrate
sudo docker-compose -f production.yml logs

sudo docker-compose -f production.yml run --rm django python manage.py shell -i ipython
docker-compose -f local.yml run --rm django python manage.py shell -i ipython

from app.utils.import_countries import create_countries


# Create db backup
docker-compose -f local.yml exec postgres backup
docker-compose -f production.yml exec postgres backup

# DB backup list
docker-compose -f local.yml exec postgres backups
docker-compose -f production.yml exec postgres backups

# Copy backup from docker to local (postgres - is container name)
docker cp postgres:/backups .

# Copy backup to docker
docker cp backup_2021_09_10T09_23_12.sql.gz postgres:/backups
docker cp ./backups/backup_2021_08_10T13_40_02.sql.gz allflags_postgres_1:/backups

# Restoring from the Existing Backup
docker-compose -f local.yml exec postgres restore backup_2021_09_10T09_23_12.sql.gz
docker-compose -f production.yml exec postgres restore backup_2021_08_10T13_40_02.sql.gz