Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I cannot for the life of me figured this out. Whenever I try and run a database migration (currently using South for Django 1.6.5), I get this error:

conn = _connect(dsn, connection_factory=connection_factory, async=async)
django.db.utils.OperationalError: could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?

I've tried every settings config that I can think of. I have a base, local, and production settings file. In my production settings file I've even copied the database dictionary values from it's info page on heroku's website to ensure that they match. ex)

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'd3...k',
    'USER': 'yvg...f',
    'PASSWORD': '...',
    'HOST': '....amazonaws.com',
    'PORT': '5432',
}

}

I don't see ANYWHERE that I'm telling it to look for localhost.

share|improve this question
    
Tell how you configured DATABASES['???'] = dj_database_url.config() ? – Raja Simon Oct 14 '14 at 5:24
    
I had DATABASES['default'] = dj_database_url.config() but it wasn't working, so I included the exact values as I posed above. – user1855009 Oct 14 '14 at 12:40
    
wat error you getting wen default ..? – Raja Simon Oct 14 '14 at 13:46

Have you checked your application to make sure DATABASE_URL is set? It should point to the database you're trying to use (HEROKU_POSTGRESQL_COLOR_URL of sorts). Then, use the dj_database_url.config() as @rajasimon mentioned. See here as well https://devcenter.heroku.com/articles/getting-started-with-python#provision-a-database

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.