Django inspectdb无法检查表-关系不';不存在错误

Django inspectdb无法检查表-关系不';不存在错误,django,Django,所以,我试图实现的是将我的postgres数据库中的表映射到django模型。 我尝试过使用inspectdb,但它不断抛出错误,我也不知道如何修复它。以下是我运行的代码: python3 manage.py inspectdb account 它给我的输出是: # This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * R

所以,我试图实现的是将我的postgres数据库中的表映射到django模型。 我尝试过使用
inspectdb
,但它不断抛出错误,我也不知道如何修复它。以下是我运行的代码:

python3 manage.py inspectdb account
它给我的输出是:

# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
#   * Rearrange models' order
#   * Make sure each model has one field with primary_key=True
#   * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior
#   * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
from django.db import models
# Unable to inspect table 'account'
# The error was: relation "account" does not exist
LINE 1: SELECT * FROM "account" LIMIT 1
我认为这里发生的事情是,出于某种原因,inspectdb使用双引号包装表名,这对
psql
语法是不正确的,这是导致错误的直接原因

我已经检查了django使用的数据库用户是否可以访问该表,并且当我尝试运行相同的查询时,没有表名上的引号,它给了我一个正确的输出:

database=# SELECT * FROM my_schema.account LIMIT 1;
 id | username | email | password_hash | confirmed | last_login_time 
----+----------+-------+---------------+-----------+-----------------
(0 rows)
Django数据库配置:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'database',
        'USER': 'db_admin',
        'PASSWORD': 'temporary_password',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}
有人遇到过这个问题并解决了吗?或者我用错了工具?
感谢您的帮助

您必须将架构添加到searchpath

    'OPTIONS': {
        'options': '-c search_path=myschema'
    }

给我们看看你的数据库config@iklinac我可以肯定它连接到了正确的数据库,因为它曾经因为错误的密码而失败,但我改变了它,现在它连接没有问题。