Saturday, October 22, 2016

Django can't find database

Hi all,

Debian System, stretch, 64 bit. KDE4 Desktop
Django 1.10
Postgresql 9.6 with psycopg2



When I try to migrate, I get the following error:

> Traceback (most recent call last):
> File "/home/gary/workspace/djenv/lib/python3.5/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection
> self.connect()
> File "/home/gary/workspace/djenv/lib/python3.5/site-packages/django/db/backends/base/base.py", line 171, in connect
> self.connection = self.get_new_connection(conn_params)
> File "/home/gary/workspace/djenv/lib/python3.5/site-packages/django/db/backends/postgresql/base.py", line 175, in get_new_connection
> connection = Database.connect(**conn_params)
> File "/home/gary/workspace/djenv/lib/python3.5/site-packages/psycopg2/__init__.py", line 164, in connect
> conn = _connect(dsn, connection_factory=connection_factory, async=async)
> psycopg2.OperationalError: FATAL: database "archivedb" does not exist

My settings file looks like this:

> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
> 'NAME': 'archivedb',
> 'USER': 'gary',
> 'PASSWORD': 'zzyyxx', # WARNING If they get this far I'm screwed anyway
> 'HOST': 'localhost',
> 'PORT': '5432',
> }
> }

My pgAdminIII Object Browser:

See attachment Spectacl.....
And SQL Pane for Gary:

> CREATE ROLE gary LOGIN
> ENCRYPTED PASSWORD 'md5772cde60e4a04dc0cb7268674810bf03'
> SUPERUSER INHERIT CREATEDB CREATEROLE REPLICATION;

The pg_hba.conf file at /etc/postgresql/9.6/main is:

> # Database administrative login by Unix domain socket
> local all postgres trust
>
> # TYPE DATABASE USER ADDRESS METHOD
>
> # "local" is for Unix domain socket connections only
> local all all trust
> # IPv4 local connections:
> host all all 127.0.0.1/32 trust
> # IPv6 local connections:
> host all all ::1/128 trust
> # Allow replication connections from localhost, by a user with the
> # replication privilege.
> #local replication postgres peer
> #host replication postgres 127.0.0.1/32 md5
> #host replication postgres ::1/128 md5

What's happening here?

Any help will be sincerely appreciated.

Gary R.







--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fdaf6530-6b5d-8f63-06c1-d63cca2296b2%40verizon.net.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment