Search code examples
pythondjangodjango-settingsdjango-database

Django settings.DATABASE error


EDIT I'm receiving this error when migrating:

raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

My DATABASE config for settings.py is like so:

DATABASES = { 
  'default': {},
  'db1': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'metrix1',
    'USER': 'appserver',
    'PASSWORD': '***',
    'HOST': 'localhost',
    'PORT': '2323',
  },  
  'db2': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'metrix2',
    'USER': 'appserver',
    'PASSWORD': '***',
    'HOST': 'localhost',
    'PORT': '2324',
  },  
}

Any help would be great! Thanks.

EDIT THIS PART FIXED there was a typo with the user credentials.

Also getting this error--not sure if it's related to the settings.DATABASES error I'm receiving:

OperationalError at /counters_app/
(1045, "Access denied for user 'appserver'@'localhost' (using password: YES)")
Request Method: POST
Request URL:    http://127.0.0.1:8000/counters_app/
Django Version: 1.9
Exception Type: OperationalError
Exception Value:    
(1045, "Access denied for user 'appserver'@'localhost' (using password: YES)")
Exception Location: /usr/local/lib/python2.7/site-packages/MySQLdb/connections.py in __init__, line 204
Python Executable:  /usr/local/opt/python/bin/python2.7
Python Version: 2.7.10
Python Path:    

Solution

  • You must configure 'default' database, according to settings documentation.