Joe
Joe

Reputation: 26777

Django tutorial says I haven't set DATABASE_ENGINE setting yet... but I have

I'm working through the Django tutorial and receiving the following error when I run the initial python manage.py syncdb:

Traceback (most recent call last):
File "manage.py", line 11, in <module>
  execute_manager(settings)
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 362 in execute_manager
  utility.execute()
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 303, in execute
  self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 195, in run_from_argv
  self.execute(*args, **options.__dict__)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 222, in execute
  output = self.handle(*args, **options)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 351, in handle
  return self.handle_noargs(**options)
File "/Library/Python/2.6/site-packages/django/core/management/commands/syncdb.py", line 49, in handle_noargs
  cursor = connection.cursor()
File "/Library/Python/2.6/site-packages/django/db/backends/dummy/base.py", line 15, in complain
  raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE setting yet."
django.core.exceptions.ImproperlyConfigured: You haven't set the DATABASE_ENGINE setting yet.

My settings.py looks like:

DATABASES = {
  'default': {
    'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
    'NAME': 'dj_tut',                      # Or path to database file if using sqlite3.
    'USER': '',                      # 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.
  }
}

I'm guessing this is something simple, but why isn't it seeing the ENGINE setting?

Upvotes: 5

Views: 11878

Answers (4)

Montaro
Montaro

Reputation: 9818

Same problem happened frequently to me and everytime the problem was cyclic dependencies between sttings.py and another module.

Upvotes: 1

fatih kaplan
fatih kaplan

Reputation: 1

At command prompt you should write:

edit settings.py

then there will be a new module for editing your

settings.py

Upvotes: -3

Daniel Roseman
Daniel Roseman

Reputation: 599610

It looks like you are using an earlier version of Django. That way of setting database configuration is from Django 1.2, but the error you are getting is from 1.1. If you are using version 1.1, use this version of the tutorial.

Upvotes: 13

Gabriel
Gabriel

Reputation: 18780

'ENGINE': 'mysql',
'NAME': 'dj_tut',

and you will want to set a user and password.

Upvotes: 2

Related Questions