所以我成功升级了django站点(django 1.4 - 1.11.Python 2.5 - 3.5.Django-CMS 2.4 - 3.5)我从一个新的数据库开始,迁移,迁移,一切都很顺利。没有冲突,没有问题。
是的,我现在在本地完成所有工作。我的互联网很恐怖,所以我宁愿在本地做,让它工作然后部署它。
现在我来到网站,进入管理员,一切都在那里,除了一个特定的插件(片段),没有页面。完全没有。其他一切都很好,当我去发布一个空页面时,我收到以下错误:
Exception Type: IntegrityError at /en/cms_wizard/create/
Exception Value: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`eo_web_live`.`cms_page`, CONSTRAINT `site_id_refs_id_5f61f09c` FOREIGN KEY (`site_id`) REFERENCES `django_site` (`id`))')
以下是包含设置的完整回溯:
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/en/cms_wizard/create/
Django Version: 1.11.10
Python Version: 3.6.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_comments',
'djangocms_admin_style',
'django.contrib.admin',
'djangocms_text_ckeditor',
'cms',
'mptt',
'menus',
'treebeard',
'filer',
'easy_thumbnails',
'sekizai',
'reversion',
'gunicorn',
'compressor',
'form_designer',
'store_locator',
'cms_redirects',
'eo_registration',
'eo_jobs',
'djangocms_link',
'djangocms_file',
'djangocms_picture',
'djangocms_video',
'djangocms_googlemap',
'djangocms_snippet',
'djangocms_style',
'djangocms_column',
'cmsplugin_filer_file',
'cmsplugin_filer_folder',
'cmsplugin_filer_link',
'cmsplugin_filer_image',
'cmsplugin_filer_teaser',
'cmsplugin_filer_video',
'eo_cms',
'eo_cms.plugins.feature_block',
'eo_cms.plugins.teaser_block',
'eo_cms.plugins.profile_block',
'eo_cms.plugins.accordion_block',
'eo_cms.plugins.tabbed_block',
'eo_jobs.plugins.job_listings_block',
'tagging',
'eo_zinnia_blog_theme',
'cmsplugin_zinnia',
'zinnia',
'eo_survey',
'eo_consultants',
'eo_consultants.plugins.consultants_block',
'eo_consultants.plugins.consultant_profile_block',
'rosetta',
'bootstrapform',
'helpdesk')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.admindocs.middleware.XViewMiddleware',
'django.middleware.http.ConditionalGetMiddleware',
'django.middleware.common.CommonMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms_redirects.middleware.RedirectFallbackMiddleware')
Traceback:
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py" in execute
101. return self.cursor.execute(query, args)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/mysqlclient-1.3.12-py3.6-linux-x86_64.egg/MySQLdb/cursors.py" in execute
250. self.errorhandler(self, exc, value)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/mysqlclient-1.3.12-py3.6-linux-x86_64.egg/MySQLdb/connections.py" in defaulterrorhandler
50. raise errorvalue
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/mysqlclient-1.3.12-py3.6-linux-x86_64.egg/MySQLdb/cursors.py" in execute
247. res = self._query(query)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/mysqlclient-1.3.12-py3.6-linux-x86_64.egg/MySQLdb/cursors.py" in _query
411. rowcount = self._do_query(q)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/mysqlclient-1.3.12-py3.6-linux-x86_64.egg/MySQLdb/cursors.py" in _do_query
374. db.query(q)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/mysqlclient-1.3.12-py3.6-linux-x86_64.egg/MySQLdb/connections.py" in query
277. _mysql.connection.query(self, query)
The above exception ((1452, 'Cannot add or update a child row: a foreign key constraint fails (`eo_web_live`.`cms_page`, CONSTRAINT `site_id_refs_id_5f61f09c` FOREIGN KEY (`site_id`) REFERENCES `django_site` (`id`))')) was the direct cause of the following exception:
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/views/generic/base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/cms/wizards/views.py" in dispatch
45. return super(WizardCreateView, self).dispatch(*args, **kwargs)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/formtools/wizard/views.py" in dispatch
248. response = super(WizardView, self).dispatch(request, *args, **kwargs)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/views/generic/base.py" in dispatch
88. return handler(request, *args, **kwargs)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/formtools/wizard/views.py" in post
309. return self.render_done(form, **kwargs)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/formtools/wizard/views.py" in render_done
365. done_response = self.done(final_forms.values(), form_dict=final_forms, **kwargs)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/cms/wizards/views.py" in done
145. instance = form_two.save()
File "/usr/lib/python3.6/contextlib.py" in inner
52. return func(*args, **kwds)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/cms/forms/wizards.py" in save
160. new_page = super(CreateCMSPageForm, self).save(**kwargs)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/cms/admin/forms.py" in save
272. new_page.save()
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/cms/models/pagemodel.py" in save
762. super(Page, self).save(**kwargs)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/models/base.py" in save
808. force_update=force_update, update_fields=update_fields)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/cms/models/pagemodel.py" in save_base
777. return super(Page, self).save_base(*args, **kwargs)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/models/base.py" in save_base
838. updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/models/base.py" in _save_table
924. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/models/base.py" in _do_insert
963. using=using, raw=raw)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/models/manager.py" in manager_method
85. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/models/query.py" in _insert
1076. return query.get_compiler(using=using).execute_sql(return_id)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in execute_sql
1112. cursor.execute(sql, params)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
79. return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/utils.py" in __exit__
94. six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/utils/six.py" in reraise
685. raise value.with_traceback(tb)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py" in execute
101. return self.cursor.execute(query, args)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/mysqlclient-1.3.12-py3.6-linux-x86_64.egg/MySQLdb/cursors.py" in execute
250. self.errorhandler(self, exc, value)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/mysqlclient-1.3.12-py3.6-linux-x86_64.egg/MySQLdb/connections.py" in defaulterrorhandler
50. raise errorvalue
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/mysqlclient-1.3.12-py3.6-linux-x86_64.egg/MySQLdb/cursors.py" in execute
247. res = self._query(query)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/mysqlclient-1.3.12-py3.6-linux-x86_64.egg/MySQLdb/cursors.py" in _query
411. rowcount = self._do_query(q)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/mysqlclient-1.3.12-py3.6-linux-x86_64.egg/MySQLdb/cursors.py" in _do_query
374. db.query(q)
File "/home/tom/Desktop/EO/development/venv/lib/python3.6/site-packages/mysqlclient-1.3.12-py3.6-linux-x86_64.egg/MySQLdb/connections.py" in query
277. _mysql.connection.query(self, query)
据我所知,似乎是一个错误的事实是' site-id'引用了“django-site(id)'但我不能为我的生活找到一个site-id在数据库中引用任何内容的地方。
更新
因此,在搜索并查找一些命令以检查表格的数据库引擎并确认它们完全相同后,我遇到了这个有趣的部分:
CONSTRAINT `site_id_refs_id_5f61f09c` FOREIGN KEY (`site_id`) REFERENCES `django_site` (`id`)
Trying to add in child table, in index cms_page_99732b5c tuple:
DATA TUPLE: 2 fields;
0: len 4; hex 80000000; asc ;;
1: len 4; hex 80005970; asc Yp;;
But in parent table `eo_web_live`.`django_site`, in index PRIMARY,
the closest match we can find is record:
PHYSICAL RECORD: n_fields 5; compact format; info bits 0
0: len 4; hex 80000001; asc ;;
1: len 6; hex 00000000f556; asc V;;
2: len 7; hex bc000001480110; asc H ;;
3: len 24; hex 7777772e657865637574697665736f6e6c696e652e6e6574; asc www.companysite.com;;
4: len 24; hex 7777772e657865637574697665736f6e6c696e652e6e6574; asc www.companysite.com;;
看起来站点和页面的物理ID都被保存为一个全新的十六进制值(更长的长度),我猜测它是新Django或新Django-CMS的一个特性。
我不确定这是否意味着我必须更改旧值或者其他完全错误。
非常感谢任何帮助或有益的侮辱。提前谢谢。