I created a database named testdb1in postgresql, and I'm trying to connect it to my application django. But when I run python manage.py syncdb, I get an error django.db.utils.OperationalError: FATAL: database "testdb1" does not exist. The database exists because it is confirmed by the following:
archit@archit-Inspiron-5520:~/Documents/DjangoLabs/gswd$ psql -U postgres
Password for user postgres:
psql (9.1.14)
Type "help" for help.
postgres=
You are now connected to database "testdb1" as user "postgres".
testdb1=
List of relations
Schema | Name | Type | Owner
--------+---------+-------+----------
public | company | table | postgres
(1 row)
In settings.pyI have:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'testdb1',
'USER': 'postgres',
'PASSWORD': 'admin',
'HOST': 'localhost',
'PORT': '',
}
}
In /etc/postgresql/9.1/main/pg_hba.conf:
local all postgres md5
local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
local all postgres md5
EDIT:
Team\du gives:
testdb1=
List of roles
Role name | Attributes | Member of
archit | Superuser, Create role, Create DB, Replication | {}
postgres | Superuser, Create role, Create DB, Replication | {}
Any help would be appreciated.
source
share