8

Guys i'm so confused i've installed Django, and run the server ok, but when try to configure the database an run the db sync command it crash returning the my ENGINE parameter is not OK, but the settings file is OK. Follow the settings file:

    DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'mysite',                      # Or path to database file if using sqlite3.
        'USER': 'root',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}

And the Error:

 Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs
    cursor = connection.cursor()
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/dummy/base.py", line 15, in complain
    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.

Thanks in advance!

Aamir Rind
  • 38,793
  • 23
  • 126
  • 164
guisantogui
  • 4,017
  • 9
  • 49
  • 93
  • 2
    Try adding `--settings=myapp.settings` after after syncdb... This sometimes helps.. – Tisho Jul 12 '12 at 17:38
  • I've executed this: python manage.py --settings=mysite.settings syncdb and i got this: Unknown command: '--settings=mysite.settings' :( I'm using Django 1.4 – guisantogui Jul 12 '12 at 17:45
  • 5
    python manage.py syncdb --settings=mysite.settings order is important :) – Colin Dunklau Jul 12 '12 at 17:48
  • i run it > "python manage.py syncdb --settings=mysite.settings" and i got the same error, that when i've executed just > "python manage.py syncdb", ideas? – guisantogui Jul 12 '12 at 17:58
  • what happens if you change 'django.db.backends.mysql' to 'mysql'? – RickyA Jul 12 '12 at 19:52
  • i got the same error: "please supply the ENGINE value" :( – guisantogui Jul 13 '12 at 12:43
  • I got this problem, i copy that setting into the another setting.py file that was inside that another directory, thanks all for the help! – guisantogui Jul 13 '12 at 13:23
  • 4
    Check out http://stackoverflow.com/questions/10228618/settings-databases-is-improperly-configured-error-performing-syncdb-with-djang – DataGreed Jul 20 '12 at 09:20
  • 1
    Same problem, I have ENGINE set to django.db.backends.sqlite3 yet I still get that ENGINE not set error – ss7 Nov 04 '15 at 22:35

2 Answers2

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

use above settings please check for grant permission for mysql user and specify host and port.

sid
  • 1
  • 1
0

I know this post is ancient, but I just encountered the same error. For me, the issue was with a mismatch with USER and PASSWORD. I eventually just went into the database and manually reset the password, and then put the new password in the script. This fixed the problem for me.

  • I had recently this problem and it was due to the lack of a comma between two databases dictionaries. ```ImproperlyConfigured``` implicates a lot of different variables around the DATABASES dictionary: content and form. – RicHincapie Apr 06 '21 at 22:59