[Django] 데이터베이스 데이터 백업 및 적재

Django에서 데이터베이스의 데이트를 백업하거 복구 할 수 있습니다. dumpdata, loaddata를 사용합니다.

데이터 백업

  1. weather 앱에 포함덴 Today 모델 지정 하여 dump
    python manage.py dumpdata weather.Today --indent 4 > dumpdata/20170509/Today.json
    
  2. App에 포함된 전체 모델 dump
    python manage.py dumpdata weather --indent 4 > dumpdata/20170509/weather.json
    
  3. 프로젝트 전체 dump
    python manage.py dumpdata --indent 4 > dumpdata/20170509/weather-project.json
    

데이터 복구

loaddata를 사용하여 dump 받은 파일을 입력하면 해당 파일로 데이터가 복구 됩니다.

python manage.py loaddata dumpdata/20170509/Today.json

modu namu

modu namu
Step by Step. GRIT!

[App] DB Browser for SQLite

DB Browser for SQLite 소개 Continue reading

[Django] slack 연동

Published on December 02, 2017

[Spring Boot] @Scheduler

Published on December 02, 2016