B
B
Boldy2015-02-14 17:09:07
MySQL
Boldy, 2015-02-14 17:09:07

Why can't I restore data from a dump in django?

Moving from MySQL to sqlite.
I do:

./manage.py dumpdata > dump.json --natural #пробовал -e contenttypes
#смена настроек на sqlite
./manage.py loaddata dump.json

Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/loaddata.py", line 61, in handle
    self.loaddata(fixture_labels)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/loaddata.py", line 91, in loaddata
    self.load_label(fixture_label)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/loaddata.py", line 142, in load_label
    for obj in objects:
  File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/json.py", line 81, in Deserializer
    six.reraise(DeserializationError, DeserializationError(e), sys.exc_info()[2])
  File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/json.py", line 75, in Deserializer
    for obj in PythonDeserializer(objects, **options):
  File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/python.py", line 129, in Deserializer
    obj = field.rel.to._default_manager.db_manager(db).get_by_natural_key(*field_value)
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/contenttypes/models.py", line 21, in get_by_natural_key
    ct = self.get(app_label=app_label, model=model)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 92, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 357, in get
    self.model._meta.object_name)
django.core.serializers.base.DeserializationError: Problem installing fixture 'dump.json': ContentType matching query does not exist.

What can be wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Guest007, 2015-02-14
@Boldy

Make a dump now and compare the structure - perhaps it is the difference in the composition of the fields / tables that bothers you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question