Django's error in Heroku: "Please set the ENGINE value"

I read and applied the tutorial “Getting Started with Django on Heroku”, but ran into a problem when synchronizing 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 put the Django database configuration value in ENGINE format and "DATA DIRECTLY configured." Syncdb runtime error with django 1.4 , but still getting the same error. Performing

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

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

Django version is 1.4.

+7
source share
6 answers

I 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 the changes using these commands:

 git add -A git commit -m "commit" git push -f heroku 
+1
source

I came across the same question, but apparently for various reasons. 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.

+10
source

After trying all the answers here and checking DATABASE_URL, nothing worked.

I added a second line and worked

 DATABASES['default'] = dj_database_url.config() <--- heroko docs says this is enough DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2' <---- add this 
+6
source

Verify that the database add-in is installed and configured correctly. See https://devcenter.heroku.com/articles/database#no-dev-database-or-no-database-url

To fix the problem, I ran the following:

 heroku addons:add heroku-postgresql heroku pg:promote HEROKU_POSTGRESQL_CYAN 
+3
source

Try a 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 as follows:

 manage.py <options> <command> 

Another problem (lack of ENGINE installation) may be caused by the incorrect settings file that is used during the syncdb command. The above should also fix this.

0
source

a little late; but you just delete all the django database default settings lines; and add to the hero.

it will work correctly

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

example:

 if socket.gethostname() == 'xx': DATABASE_SETTINGS ={ } elif socket.gethostname() == 'xxx': another database settings... 

so that you can run the project under multiple hosts.

0
source

All Articles