Search code examples
djangopostgresqldjango-south

PostgreSQL & Heroku - cannot connect to the database


I'm trying to add a column to a table via my Django app with South but keep getting the following error upon running the python manage.py migrate <app name> command:

conn = _connect(dsn, connection_factory=connection_factory, async=async)
psycopg2.OperationalError: could not translate host name "ec2-107-21-99-105.comp
ute-1.amazonaws.com" to address: Temporary failure in name resolution

Does anybody have an idea why this is happening? I'm a newbie to both South AND the PostgreSQL database management system (which Heroku uses), so I am more than a bit confused.


Solution

  • Make sure you have defined your default database in settings.py like this:

    DATABASES = {
        'default': dj_database_url.config(default=os.environ.get('DATABASE_URL'))
    }