Alex Rivera | Logout

Django error in Heroku: "Please supply the ENGINE value"

Asked 2012-08-06T10:15:46.200
10

I read and apply "Getting started with Django on Heroku" tutorial but ran into problem while syncing db:

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

I read Please supply the ENGINE value Django database configuration and “settings.DATABASES is improperly configured” error performing syncdb with django 1.4 but still receive same error. While executing

heroku run python manage.py --settings=moz455.settings syncdb

I receive error "Unknown command: '--settings=moz455.settings'". How to solve this problem?

Version of Django is 1.4.

Edit
Report

3 Answers

12

I ran into the same issue, but apparently for different reasons. In the Heroku docs at https://devcenter.heroku.com/articles/django#prerequisites, it says to add the following to settings.py:

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

You can pass in a parameter of:

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

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

$ heroku config

I saw the Database URL assigned to a separate config variable. So I created a new variable:

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

That solved my problem. I hope it helps anyone else with similar issues.

answered 2013-04-10T23:55:36.953
0

Try different order:

heroku run python manage.py syncdb --settings=moz455.settings

The manage.py command looks like this:

manage.py <command> <options>

but you used it like this:

manage.py <options> <command>

Your other problem (lack of ENGINE setting) may be caused by incorrect settings file being used during the syncdb command execution. The above should fix it also.

answered 2012-08-06T10:40:51.283
0

it is a little late ; but you just delete all default django database settings lines ; and add heroku's one.

it will work correctly

** edit ** or simply you can use `socket.gethostname().

example :

if socket.gethostname() == 'xx':
    DATABASE_SETTINGS ={ }

elif socket.gethostname() == 'xxx':
    another database settings...

so you can run your project under multiple hosts.

answered 2012-09-24T20:44:48.910

Your Answer