0

I have a local_settings.py that contains the database settings for my local postgre database. My settings.py database looks like this.

   DATABASES = {
   'default': {
   'ENGINE': 'django.db.backends.postgresql_psycopg2',  
    'NAME': '', 
    'USER': '',
    'PASSWORD': '',
    'HOST': '', 
    'PORT': '',  
    }
   }

 ALLOWED_HOSTS = ['*']

 import dj_database_url

 DATABASES['default'] =   dj_database_url.config(default='postgres://mylocalusername:mylocalpass@OK@localhost/mylocaldb')

 SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

While deploying, after I created a new database using heroku addons:create heroku-postgresql:hobby-dev , I tried to run 'heroku run python manage.py migrate' before I could import my local database but I got the following error-

And this is the error I get.

    raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
    django.core.exceptions.ImproperlyConfigured: settings.DATABASES is   improperly configured. Please supply the ENGINE value. Check settings   documentation for moredetails.

I also tried to run the following commands after database creation.

heroko config
heroko config:add DATABASE_URL={#the database url}
WutWut
  • 1,204
  • 2
  • 17
  • 31
  • 1
    Firstly, local_settings is presumably not in your git repo so isn't uploaded to Heroku: it's the main settings.py you should edit. And secondly, the [Heroku docs](https://devcenter.heroku.com/articles/getting-started-with-django#django-settings) are very clear about how you use `dj-database-url` to set the db location for deployment; what problems did you have following them? – Daniel Roseman Jun 24 '15 at 20:51
  • All the edits I've made have been in the `settings.py`. About the dj_database_url, I've checked out this answer http://stackoverflow.com/questions/14795824/improperlyconfiguredsettings-databases-is-improperly-configured-error-when that gives a solution but this does not work – WutWut Jun 24 '15 at 20:58
  • Can you share the edits you made to `settings.py`, specifically including `dj_database_url` code? – bimsapi Jun 24 '15 at 22:04
  • @bimsapi I've edited the question to look like where I am now with the problem. – WutWut Jun 24 '15 at 22:13
  • The `dj_database_url` code looks right. Next suggestions: 1) Make sure that `manage.py` is referencing the right settings -or- override `DJANGO_SETTINGS_MODULE` as a config var; 2) make sure that, if you are referencing the right settings file, you are not accidentally over-riding it via an import like `from .local_settings import *`; 3) unset the database url and re-provision the database. Heroku will inject the environment var for you. – bimsapi Jun 27 '15 at 00:33

0 Answers0