Django 迁移错误

真正的新手

将 Psycopg2==2.7.4 导入我的服务器后,我无法再正常运行我的服务器。添加新字段后,每当我尝试在 makemigrations(python manage.py migrate) 之后进行迁移时,都会在我的终端中发生这种情况:

 Apply all migrations: admin, auth, buddysapp, contenttypes, oauth2_provider, sessions, social_django
Running migrations:
  Applying buddysapp.0038_auto_20180321_0025...Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/hsi/Desktop/myvirtualenv/buddys/lib/python3.6/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/Users/hsi/Desktop/myvirtualenv/buddys/lib/python3.6/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/hsi/Desktop/myvirtualenv/buddys/lib/python3.6/site-packages/django/core/management/base.py", line 305, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/hsi/Desktop/myvirtualenv/buddys/lib/python3.6/site-packages/django/core/management/base.py", line 356, in execute
    output = self.handle(*args, **options)
  File "/Users/hsi/Desktop/myvirtualenv/buddys/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 202, in handle
    targets, plan, fake=fake, fake_initial=fake_initial
  File "/Users/hsi/Desktop/myvirtualenv/buddys/lib/python3.6/site-packages/django/db/migrations/executor.py", line 97, in migrate
    state = self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/Users/hsi/Desktop/myvirtualenv/buddys/lib/python3.6/site-packages/django/db/migrations/executor.py", line 132, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/Users/hsi/Desktop/myvirtualenv/buddys/lib/python3.6/site-packages/django/db/migrations/executor.py", line 237, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/Users/hsi/Desktop/myvirtualenv/buddys/lib/python3.6/site-packages/django/db/migrations/migration.py", line 129, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/Users/hsi/Desktop/myvirtualenv/buddys/lib/python3.6/site-packages/django/db/migrations/operations/fields.py", line 84, in database_forwards
    field,
  File "/Users/hsi/Desktop/myvirtualenv/buddys/lib/python3.6/site-packages/django/db/backends/sqlite3/schema.py", line 231, in add_field
    self._remake_table(model, create_fields=[field])
  File "/Users/hsi/Desktop/myvirtualenv/buddys/lib/python3.6/site-packages/django/db/backends/sqlite3/schema.py", line 113, in _remake_table
    self.effective_default(field)
  File "/Users/hsi/Desktop/myvirtualenv/buddys/lib/python3.6/site-packages/django/db/backends/sqlite3/schema.py", line 68, in quote_value
    raise ValueError("Cannot quote parameter value %r of type %s" % (value, type(value)))
ValueError: Cannot quote parameter value <psycopg2._json.Json object at 0x10ea5e748> of type <class 'psycopg2._json.Json'>

任何想法,让我知道。

更新:迁移文件 0038

rom __future__ import unicode_literals

import buddysapp.models
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('buddysapp', '0037_auto_20180318_1816'),
    ]

    operations = [
        migrations.AddField(
            model_name='dispensary',
            name='businessHours',
            field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=buddysapp.models.business_hours_default, null=True),
        ),
        migrations.AlterField(
            model_name='order',
            name='status',
            field=models.IntegerField(choices=[(1, 'Your Order Is Being Picked Right Off The Plant!'), (2, 'Picked, Weighed, And Ready For Delivery.'), (3, 'The Best Bud Is Heading Straight To Your Door.'), (4, 'Delivered'), (0, 'Canceled/Refunded')]),
        ),
    ]

阿拉斯代尔

您不能将JSONFieldfromdjango.contrib.postgres与 Sqlite3 数据库一起使用。

您需要设置 PostgreSQL 数据库并更新您的DATABASES设置,或者在您的模型中使用不同的字段。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Django 1.7.1的迁移错误

来自分类Dev

Django迁移错误-NodeNotFoundError

来自分类Dev

Django迁移错误KeyError :(“列表”,“用户”)

来自分类Dev

Django日期时间迁移错误

来自分类Dev

Django + django-oauth-toolkit上的迁移错误

来自分类Dev

Django迁移错误:该列不存在

来自分类Dev

在Heroku上部署时的Django 1.7迁移错误

来自分类Dev

Django mptt数据库迁移错误

来自分类Dev

Django迁移错误名称“ bPath”未定义

来自分类Dev

Django迁移错误无法适应UUID类型

来自分类Dev

使用 django-csvimport 的项目迁移错误

来自分类Dev

Django 2.0 迁移错误:“django.core.exceptions.AppRegistryNotReady:应用程序尚未加载。”

来自分类Dev

Django Port从Postgres迁移到MariaDB manage.py迁移错误SQL语法错误1064

来自分类Dev

将详细名称添加到外键字段时,django 1.7迁移错误

来自分类Dev

Tastypie迁移错误

来自分类Dev

Rails:迁移错误

来自分类Dev

添加迁移错误

来自分类Dev

Laravel 4迁移错误?

来自分类Dev

松露迁移错误

来自分类Dev

Laravel 5.5 迁移错误

来自分类Dev

因此,在同时删除类及其子类时,我遇到了Django迁移错误,这与sqlite3一起显示为sql语法错误

来自分类Dev

Heroku耙db:迁移错误

来自分类Dev

rake db:migrate发生迁移错误

来自分类Dev

Laravel 5迁移错误1045

来自分类Dev

数据库迁移错误

来自分类Dev

rest_framework authtoken迁移错误

来自分类Dev

Laravel使用迁移错误创建表

来自分类Dev

Knex迁移错误.spread()不是函数

来自分类Dev

Bundle Exec Rake DB迁移错误