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.
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.
After trying all the answers here and verifying DATABASE_URL exists, nothing worked.
I added the second line and it worked
DATABASES['default'] = dj_database_url.config() <--- heroko docs says this is enough
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2' <---- add this
Ensure that you have the database add-on installed and setup properly. See https://devcenter.heroku.com/articles/database#no-dev-database-or-no-database-url
I ran the following to fix the issue:
heroku addons:add heroku-postgresql
heroku pg:promote HEROKU_POSTGRESQL_CYAN
Solved it myself: in manage.py add code similar to this:
CurDir = os.path.dirname(os.path.abspath(__file__))
ProjectDir = os.path.join(CurDir, "moz455")
sys.path += [ProjectDir]
And commit changes with these commands:
git add -A
git commit -m "commit"
git push -f heroku
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With