Question

I started a Django project, but I get an error with database settings. The homepage works fine:

It worked!
Congratulations on your first Django-powered page.

Of course, you haven't actually done any work yet. Next, start your first app by
running python manage.py startapp [appname].
You're seeing this message because you have DEBUG = True in your Django settings file 
and you haven't configured any URLs. Get to work!

But I get this error is console:

settings.DATABASES is improperly configured. Please supply the ENGINE
value. Check settings documentation for more details.

Request Method:     GET Request URL:    http://fireidea.net/ Django
Version:    1.6.2 Exception Type:   ImproperlyConfigured Exception Value:


settings.DATABASES is improperly configured. Please supply the ENGINE
value. Check settings documentation for more details.

Exception Location:
    /home2/minhhien/webapps/django/django/db/backends/dummy/base.py in
complain, line 15 Python Executable:    /usr/bin/python Python Version:
    2.7.5 
...

Database settings:

MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql'
DATABASE_NAME = ''
DATABASE_USER = ''
DATABASE_PASSWORD = ''
DATABASE_HOST = 'localhost'
DATABASE_PORT = ''

#DATABASES = {
#    'default': {
#        'ENGINE': '',
#        'NAME': '',
#        'HOST': 'localhost',
#        'PORT': '',
#        'USER': '',
#        'PASSWORD': ''
#    }
#}
Was it helpful?

Solution

Django 1.6 expects DATABASES to be a dictionary. You commented it out, and put some older settings format in there. You should change it back to:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': '',
        'HOST': 'localhost',
        'PORT': '',
        'USER': '',
        'PASSWORD': ''
    }
}

See more about this here: https://docs.djangoproject.com/en/1.6/ref/databases/

OTHER TIPS

You're using settings variables DATABASES_* which was already deprecated in Django 1.2, 5 years ago now!

You need to use a dictionary, as the default setting might have pre-filled for you:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': '',
        'HOST': 'localhost',
        'PORT': '',
        'USER': '<user>',
        'PASSWORD': ''
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top