title: Deploying Django app's local postgres database to heroku?
body: <p>I am unsuccesfully getting my django app deployed on heroku to use my local postgres db.</p>
  
  <p>My DATABASE settings are as follows:</p>
  
  <pre><code>DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.postgresql_psycopg2',
          'NAME': 'mydb',
          'USER': 'foo',
          'PASSWORD': 'bar',
          'HOST': 'localhost',
          'PORT': '',
      }
  }
  </code></pre>
  
  <p>Everything runs fine locally.  Following the instructions from <a href="https://devcenter.heroku.com/articles/django" rel="nofollow">https://devcenter.heroku.com/articles/django</a>, I add the following bit a code to the bottom of my settings file:</p>
  
  <pre><code>import dj_database_url
  DATABASES = {'default': dj_database_url.config(default='postgres://foo:bar@localhost/mydb')}
  SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
  </code></pre>
  
  <p>However, this produces the following error:</p>
  
  <p><em>OperationalError at / 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?</em></p>
  
  <p>My django app runs fine on Heroku, except when it needs to connect to the database, which is where it throws this error.</p>
  
  <p>Anyone know what I am doing wrong here?</p>