tags:

views:

634

answers:

3

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?

+1  A: 
'ENGINE': 'mysql',
'NAME': 'dj_tut',

and you will want to set a user and password.

Gabriel
+4  A: 

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.

Daniel Roseman
Thanks, that definitely seems to be the problem. Follow-up question: I created a virtualenvwrapper using --no-site-wrappers and then installed Django. It appears that I have Django 1.2.1 in the virtualenvwrapper, but Django 1.1.1 in my global site packages. Do you know why this settings.py file would be referring out to the global site package and not the one installed in the virtualenv?
Joe
Well, it's actually the `manage.py` that is referring to the global version rather than the virtualenv one - the settings are right for the version you have inside the virtualenv (1.2). Silly question: have you activated the virtualenv?
Daniel Roseman
Always worth asking the silly questions as it is very possible that I did not. I just tried again (virtualenv activated) and am now off to a different error: django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb - As a newcomer to Stackoverflow, I'm guessing I should post this seperately? Thanks for your help.
Joe
I m using django 1.2 final, but i am getting the same Error.
ha22109