Django CMS从SQLite迁移到PostgreSQL

时间:2018-05-03 09:04:33

标签: django postgresql sqlite django-cms

我正在使用Django CMS 3.5开发一个项目。我使用SQLite进行开发并在那里有数据。现在我正在尝试迁移到PostgreSQL。到目前为止我的步骤:

python manage.py dumpdata --natural-primary --natural-foreign > dump.json

切换到生产设置

python manage.py migrate
TRUNCATE django_content_type CASCADE;
python manage.py loaddata dump.json

但我遇到了下一个错误:

    Traceback (most recent call last):
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py", line 178, in __get__
    rel_obj = getattr(instance, self.cache_name)
AttributeError: 'Page' object has no attribute '_node_cache'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 69, in handle
    self.loaddata(fixture_labels)
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 109, in loaddata
    self.load_label(fixture_label)
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 175, in load_label
    obj.save(using=self.using)
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/core/serializers/base.py", line 205, in save
    models.Model.save_base(self.object, using=using, raw=True, **kwargs)
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/db/models/base.py", line 833, in save_base
    update_fields=update_fields,
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 193, in send
    for receiver in self._live_receivers(sender)
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 193, in <listcomp>
    for receiver in self._live_receivers(sender)
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/cms/signals/page.py", line 8, in pre_save_page
    instance.clear_cache(menu=True)
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/cms/models/pagemodel.py", line 963, in clear_cache
    menu_pool.clear(site_id=self.node.site_id)
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py", line 184, in __get__
    rel_obj = self.get_object(instance)
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py", line 159, in get_object
    return qs.get(self.field.get_reverse_related_filter(instance))
  File "/home/webmaster/tc56/env/lib/python3.6/site-packages/django/db/models/query.py", line 380, in get
    self.model._meta.object_name
cms.models.pagemodel.DoesNotExist: Problem installing fixture '/home/webmaster/tc56/dump.json': TreeNode matching query does not exist.

1 个答案:

答案 0 :(得分:1)

几天前这是fixed。 将登陆django CMS 3.5.3