[Answer]-Django 1.7.1 – keeps on using the dummy db engine

1πŸ‘

So I managed to fix it myself, the problem was that I had

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

This was there. because I am using Heroku, so I removed this line and it worked, now the final settings.py file looks like that:

import dj_database_url

# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases

if DEBUG:
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.sqlite3', 
            'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
            'USER': '',                      
            'PASSWORD': '',             
            'HOST': '',                     
            'PORT': '',                     
        }
        }
else:
    DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}

You must remember to change the DEBUG variable value to False when you deploy.

πŸ‘€victor175

0πŸ‘

This will happen also with later versions. It happened with me for Django 2.2
Basically it happens because dj_database_url.config() looks for DATABASE_URL and defaults to the dummy engine when the URL isn’t found.

πŸ‘€Lantern

Leave a comment