7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

djangoのデータベースをバックアップする方法

Posted at

バックアップの方法

formatを指定しない場合(--format jsonなどを書かない場合)はjson形式で出力されます。

全アプリの全テーブルデータを出力

python manage.py dumpdata > filename.json

特定のアプリの全テーブルデータを出力

python manage.py dumpdata app_name > filename.json

特定のアプリのあるテーブルデータを出力

python manage.py dumpdata app_name.table_name > filename.json

リストアの方法

python manage.py loaddata filename.json

参考

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?