@Boldy

Почему не могу восстановить данные из dump'а в django?

Переезжаю с MySQL на sqlite.
Выполняю:
./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.


В чём может быть дело?
  • Вопрос задан
  • 4236 просмотров
Решения вопроса 1
Guest007
@Guest007
Django, Python, Linux и всё такое...
Сделай дамп сейчас и сравни структуру - возможно именно разница в составе полей/таблиц тебе и мешает
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы