ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value

You are using the dj-database-url module to set DATABASES['default']. Whatever comes before the line:

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

is meaningless as you replace your database configuration in its entirety. The dj_database_url.config() loads your database configuration from the DATABASE_URL environment variable, or returns {} if the variable is not set.

Judging by your error, you didn't set the DATABASE_URL at all. Judging by the code preceding the dj_database_url.config() line, you should not be using the dj_database_url.config() function at all.

If you did want to use it, at least build a default URL:

if ON_HEROKU:
    DATABASE_URL = 'postgresql://<postgresql>'
else:
    DATABASE_URL = 'sqlite:///' + os.path.join(BASE_DIR, 'db.sqlite3')

DATABASES = {'default': dj_database_url.config(default=DATABASE_URL)}

You can use following setting for localhost

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'DatabaseName',
        'USER': 'DatabaseUserName',
        'PASSWORD': 'DatabaseUserpassword',
        'HOST': 'localhost',
        'PORT': '5432',
    }
}