I have seen many of these questions asked for Ruby but not for DJango. We have a postgres DB and created a table name Adam with our postgres user. When you psql -l
the table shows up. However, when trying to run a migrate we get an error.
FATAL: database "/var/lib/pgsql/9.3/data/Adam" does not exist
The psql -l
shows this:
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------------+----------+----------+-------------+-------------+-----------------------
Adam | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
Django settings.py looks like..
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.path.join('/var/lib/pgsql/9.3/data/', 'Adam'),
'USER': 'postgres',
'PASSWORD': 'correctlyTypePassword'
}
}
Any ideas why it thinks this doesn't exist?
Your database settings are wrong. The key "Name" should refer to the database name not its path. Try this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'Adam',
'USER': 'postgres',
'PASSWORD': 'correctlyTypePassword'
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With