Django:数据库' postgres1'不存在,但确实存在

时间:2017-04-19 12:15:45

标签: python django postgresql

python manage.py migrate

django.db.utils.OperationalError: FATAL:  database "postgres1" does not exist

但实际上我创建了角色和数据库并授予,结束一切都是正确的。

好的,然后检查createdb postgres1

createdb: database creation failed: ERROR:  database "postgres1" already exists

我该怎么理解?默认postgres postgres配置工作,但没有任何一个创建的数据库工作。

编辑:更多追溯:

     raise value.with_traceback(tb)
  File "/Users/TheKotik/tick-tock/denv/lib/python3.5/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection
    self.connect()
  File "/Users/TheKotik/tick-tock/denv/lib/python3.5/site-packages/django/db/backends/base/base.py", line 119, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/Users/TheKotik/tick-tock/denv/lib/python3.5/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 176, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/Users/TheKotik/tick-tock/denv/lib/python3.5/site-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL:  database "postgres1" does not exist

Settings.py:

 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.postgresql_psycopg2',
         'NAME': 'postgres1',
         'USER':'postgres',
         'PASSWORD':'',
         'HOST': 'localhost',
         'PORT': '',
     }
 }

0 个答案:

没有答案