4

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?

1 Answer 1

8

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'
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.