Incorrectly configured (".DATABASES settings are incorrectly configured.") Error trying to configure Django

Trying to follow the instructions here to set up a Django instance on Heroku.

I got to the installation of celery to the next step:

$ python manage.py syncdb 

when i get the following error:

Increase Incorrectly configured ("settings.DATABASES is incorrectly configured." Django.core.exceptions.ImproperlyConfigured: settings.DATABASES is incorrectly configured. Please supply the ENGINE cost. For more details, see the Setup documentation.

I believe that I have the settings.py file in the right place (project-name/project-name) and I run django 1.4.3, but when I try to run manage.py diffsettings , I get the following output:

BROKER_BACKEND = 'django' ### DATABASES = {'default': {'ENGINE': 'django.db.backends.dummy', 'TEST_MIRROR': None, 'NAME': '', 'TEST_CHARSET': None, ' TIME_ZONE ':' UTC ',' TEST_COLLATION ': None,' PORT ':' ',' HOST ':' ',' USER ':' ',' TEST_NAME ': None,' PASSWORD ':' ', "OPTIONS" : {}}}

I absolutely don't know where the django.db.backends.dummy entry comes django.db.backends.dummy , my settings.py has 'ENGINE': 'django.db.backends.postgresql_psycopg2' , which I suppose is the correct entry, even if Heroku instructions do not tell you update it at any time.

Any thoughts what I need to edit here?

+8
python sql django heroku celery
source share
3 answers

I ran into the same problem. Heroku docs at https://devcenter.heroku.com/articles/django#prerequisites say what to add to settings.py :

following:
 DATABASES['default'] = dj_database_url.config() 

You can pass a parameter:

 DATABASES['default'] = dj_database_url.config(default='postgres://user:pass@localhost/dbname') 

And this will allow you to develop locally and on Heroku. The part that REALLY SOLVES the problem I had was that the Heroku DATABASE_URL configuration environment variable was not actually set. To install this, I ran

 $ heroku config 

I saw the database URL assigned to a separate configuration variable. So I created a new variable:

 $ heroko config:add DATABASE_URL={#the database url} 

This solved my problem. Hope this helps someone else with similar issues.

+8
source share

Try adding these lines after setting DATABASE in settings.py

 # Your Database setting. DATABASES = { 'default': { 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '', # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. } } # Add these two lines. import dj_database_url DATABASES['default'] = dj_database_url.config(default='sqlite://db/sqlite3.db') 
+6
source share

Many thanks to Chatri, since you suggested adding default = 'sqlite: //db/sqlite3.db' fixed the problem.

+1
source share

All Articles