S
S
Sergey Alekseev2019-02-01 11:07:16
Django
Sergey Alekseev, 2019-02-01 11:07:16

Django how to dump a table from a specific database?

Good afternoon, I need a table fixture from a specific database.
This command does not help:

./manage.py dumpdata app.MymOdel --database name_db > data.json

The command does not fail, but the fixture is not created.
How to do it right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alternativshik, 2019-02-01
@serj2000

Is this base in settings.py? and it is necessary to indicate naturally the name from the settings.
+ Note that dumpdata uses the default manager on the model for selecting the records to dump. If you're using a custom manager as the default manager and it filters some of the available records, not all of the objects will be dumped.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question