提问者:小点点

当我有postgres特定字段时,如何设置local_settings.py?


我目前正在使用一个使用postgres数据库的Django应用程序。 在我的local_settings.py中,我使用sqlite数据库进行本地开发,代码如下:

DATABASES = {
  'default': {
      'ENGINE': 'django.db.backends.sqlite3',
      'NAME': path.join(SITE_ROOT, 'djlocal.db'),
      'USER': '',             # Not used with sqlite3.
      'PASSWORD': '',         # Not used with sqlite3.
      'HOST': '',             # Not used with sqlite3.
      'PORT': '',             # Not used with sqlite3.
  }
}

当我奔跑的时候

python manage.py migrate

出现以下错误:

ValueError: Cannot quote parameter value <django.contrib.postgres.fields.jsonb.JsonAdapter object at 0x000001A3B7C5B448> of type <class 'django.contrib.
postgres.fields.jsonb.JsonAdapter'>

有没有任何方法允许应用程序在有postgres特定字段的情况下仍然工作?


共1个答案

匿名用户

尝试将引擎名称更改为

'ENGINE': 'django.db.backends.postgresql'