I'm making a Django app with the Two Scoops of Django template. Getting this Heroku error, are my Postgres production settings off?
- 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?
- Exception Location:
/app/.heroku/python/lib/python2.7/site-packages/psycopg2/__init__.py - foreman start works fine
- Procfile:
web: python www_dev/manage.py runserver 0.0.0.0:$PORT --noreload local.py settings:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'www', 'USER': 'amyrlam', 'PASSWORD': '*', 'HOST': 'localhost', 'PORT': '5432', } }
production.py settings: commented out local settings from above, added standard Heroku Django stuff:
import dj_database_url DATABASES['default'] = dj_database_url.config()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
ALLOWED_HOSTS = ['*']
import os BASE_DIR = os.path.dirname(os.path.abspath(file)) STATIC_ROOT = 'staticfiles' STATIC_URL = '/static/'
STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), )
UPDATE: production settings, tried changing:
import dj_database_url DATABASES['default'] = dj_database_url.config(default=os.environ["DATABASE_URL"])
(named my Heroku color URL to DATABASE_URL, same link in heroku config)