python - 迁移中的 django cms 错误 - 发现错误的约束数 (0)

标签 python mysql django content-management-system

我在 AWS 中安装了应用程序并创建了一个新数据库。

我运行了 python manage.py migrate

但出现以下错误。

我用的是mysql。我不知道架构中发生了什么变化。

请帮帮我。

INSTALLED_APPS = [
     'cms',
    'treebeard',
    'menus',
    'sekizai',
    'djangocms_admin_style',
    'fluent_dashboard',
    'admin_tools',
    'admin_tools.menu',
    'admin_tools.theming',
    'admin_tools.dashboard',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'rest_framework',
]

ValueError:发现 cms_page(publisher_is_draft,application_namespace)的约束数量错误(0)

Operations to perform:
  Apply all migrations: menus, cms, admin, menu, contenttypes, sessions, currency, auth, dashboard, sites
Running migrations:
  Rendering model states... DONE
  Applying cms.0008_auto_20150121_0059...Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/var/www/apps/currency_a1/venv/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/var/www/apps/currency_a1/venv/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/www/apps/currency_a1/venv/local/lib/python3.4/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/var/www/apps/currency_a1/venv/local/lib/python3.4/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/var/www/apps/currency_a1/venv/local/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 200, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/var/www/apps/currency_a1/venv/local/lib/python3.4/site-packages/django/db/migrations/executor.py", line 92, in migrate
    self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/var/www/apps/currency_a1/venv/local/lib/python3.4/site-packages/django/db/migrations/executor.py", line 121, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/var/www/apps/currency_a1/venv/local/lib/python3.4/site-packages/django/db/migrations/executor.py", line 198, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/var/www/apps/currency_a1/venv/local/lib/python3.4/site-packages/django/db/migrations/migration.py", line 123, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/var/www/apps/currency_a1/venv/local/lib/python3.4/site-packages/django/db/migrations/operations/models.py", line 359, in database_forwards
    getattr(new_model._meta, self.option_name, set()),
  File "/var/www/apps/currency_a1/venv/local/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 318, in alter_unique_together
    self._delete_composed_index(model, fields, {'unique': True}, self.sql_delete_unique)
  File "/var/www/apps/currency_a1/venv/local/lib/python3.4/site-packages/django/db/backends/mysql/schema.py", line 87, in _delete_composed_index
    return super(DatabaseSchemaEditor, self)._delete_composed_index(model, fields, *args)
  File "/var/www/apps/currency_a1/venv/local/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 347, in _delete_composed_index
    ", ".join(columns),
ValueError: Found wrong number (0) of constraints for cms_page(publisher_is_draft, application_namespace)

卡住

amqp==1.4.9
anyjson==0.3.3
APScheduler==3.1.0
beautifulsoup4==4.4.1
billiard==3.3.0.23
celery==3.1.23
configparser==3.5.0b2
dashboardmods==1.0
DateTime==4.1.1
dj-database-url==0.4.1
Django==1.9.6
django-admin-tools==0.7.2
django-celery==3.1.17
django-classy-tags==0.7.2
django-cms==3.3.0
django-cors-headers==1.1.0
django-filter==0.13.0
django-fluent-dashboard==0.6.1
django-formtools==1.0
django-markup==1.1
django-mptt==0.8.4
django-sekizai==0.9.0
django-staff-toolbar==1.0.1
django-treebeard==4.0.1
djangocms-admin-style==1.2.2
djangocms-installer==0.8.9
djangorestframework==3.3.3
djangorestframework-apidoc==0.0.1
feedparser==5.2.1
future==0.15.2
gunicorn==19.6.0
html5lib==0.9999999
kombu==3.0.35
Markdown==2.6.6
Menus==0.1.7
mysqlclient==1.3.7
pbr==1.9.1
publicsuffix==1.1.0
Pygments==2.1.3
pytz==2016.4
requests==2.10.0
setproctitle==1.1.10
six==1.10.0
South==1.0.2
SQLAlchemy==1.0.13
stevedore==1.13.0
tzlocal==1.2.2
Unidecode==0.4.19
url==0.2.0
uWSGI==2.0.13.1
virtualenv==15.0.1
virtualenv-clone==0.2.6
virtualenvwrapper==4.7.1
zope.interface==4.1.3

最佳答案

我确实喜欢“python manage.py migrate --fake”

到目前为止,它似乎已经完成了迁移。

似乎--fake选项是在模块中传递旧 Action ,这样新安装就不会受到旧 Action 的影响,只需安装新 Action 。

但是,在这种情况下,不会为 cms 创建架构。 --fake 选项不是解决方案。有人成功了吗?

要执行的操作: 应用所有迁移:menu、menus、admin、currency、auth、dashboard、cms、contenttypes、sites、session

Running migrations:
  Rendering model states... DONE
  Applying cms.0008_auto_20150121_0059... FAKED
  Applying cms.0009_merge... FAKED
  Applying cms.0010_migrate_use_structure... FAKED
  Applying cms.0011_auto_20150419_1006... FAKED
  Applying cms.0012_auto_20150607_2207... FAKED
  Applying cms.0013_urlconfrevision... FAKED
  Applying cms.0014_auto_20160404_1908... FAKED
  Applying cms.0015_auto_20160421_0000... FAKED

python 管理.py 迁移

Operations to perform:
  Apply all migrations: dashboard, sessions, menus, currency, cms, auth, contenttypes, menu, admin, sites
Running migrations:

最后,我运行了“python manage.py managa.py cms --run-syncdb”。 执行此操作后,将创建 0008_auto_20150121_0059.py 的后续内容。

关于python - 迁移中的 django cms 错误 - 发现错误的约束数 (0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37496734/

相关文章:

python - NLTK WordNetLemmatizer 将 "US"处理为 "u"

python - 将字典值 append 到现有的 pandas 数据框

具有 NULL 值的 MySql 行未在选择查询中检索

php - 错误地将小时添加到 MySQL 表列时间戳 Laravel

mysql - 一次使用 LEFT JOIN 更新/创建多个

python - 值错误 : Too many values to unpack Django

django - 无法让 Apache 为 django 管理静态文件提供服务

python - 在没有操作系统模块的Python中设置环境变量

python - 计算列表中第二个元素的频率? (Python)

django-mptt 值错误 : Cannot use None as a query value