djangosqlitedjango-settingssyncdb

Django Tutorial - Database setup - sqlite3 (Stuck..)


So, I'm here(Database setup) in the Django Tutorial 'Writing your first Django app, part 1'. Everything up to this point has gone fine, but now I'm stuck.

I go into the outer mysite directory in DOS, and I type 'edit settings.py'. This creates a new file called 'settings.py' in the outer mysite directory, and opens up a blue DOS text-editor box, which is completely empty. In this box I have tried entering various things, saving it and exiting. If I then type edit settings.py again, the text saved is still there, as it should be.

I can not copy nor paste from/to this blue DOS text editor, so I have to type everything there, and now here, manually.

What I currently have in mysite/settings.py is this(Though, I have tried entering the info many ways, such as 'django.db.backends.sqlite3' for the engine, and entering it as 'DATABASE_ENGINE' etc...:

DATABASES = {
    'default' : {
        'ENGINE' = 'C:\Django-1.4.3\Django-1.4.3\django\db\backends\sqlite3',
        'NAME' = 'C:\DOCUMENTS and settings\Miles\My Documents\DjangoExperimentation\mysite\sqlite3.db',
        'TIMEZONE' = 'Europe/London'
    }
}

After saving this and exiting, and then entering 'python manage.py syncdb', the message I receive, which thankfully I can copy as it's of course in the main DOS window, is as follows:

C:\DOCUME~1\Miles\MYDOCU~1\DJANGO~1\mysite>python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
443, in execute_from_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 196,
 in run_from_argv
    self.execute(*args, **options.__dict__)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 232,
 in execute
    output = self.handle(*args, **options)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 371,
 in handle
    return self.handle_noargs(**options)
  File "C:\Python27\lib\site-packages\django\core\management\commands\syncdb.py"
, line 57, in handle_noargs
    cursor = connection.cursor()
  File "C:\Python27\lib\site-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 co
nfigured. Please supply the ENGINE value. Check settings documentation for more
details.

(By the way... Is there any way, in stackoverflow, to mark as code without indenting every line individually? - I have worked out copy/pasting the four spaces already)

So, help.. Please? What am I doing wrong here?

This is the readout for the whole 'djangoExperimentation' directory where I'm trying to do this stuff:

C:\DOCUME~1\Miles\MYDOCU~1\DJANGO~1>dir /s
 Volume in drive C has no label.
 Volume Serial Number is 30A4-7E91

 Directory of C:\DOCUME~1\Miles\MYDOCU~1\DJANGO~1

21/01/2013  15:42    <DIR>          .
21/01/2013  15:42    <DIR>          ..
22/01/2013  11:36    <DIR>          mysite
               0 File(s)              0 bytes

 Directory of C:\DOCUME~1\Miles\MYDOCU~1\DJANGO~1\mysite

22/01/2013  11:36    <DIR>          .
22/01/2013  11:36    <DIR>          ..
21/01/2013  15:42               259 manage.py
21/01/2013  17:42    <DIR>          mysite
22/01/2013  11:36               268 settings.py
               2 File(s)            527 bytes

 Directory of C:\DOCUME~1\Miles\MYDOCU~1\DJANGO~1\mysite\mysite

21/01/2013  17:42    <DIR>          .
21/01/2013  17:42    <DIR>          ..
21/01/2013  15:42             5,363 settings.py
21/01/2013  17:42             2,837 settings.pyc
21/01/2013  15:42               573 urls.py
21/01/2013  17:42               286 urls.pyc
21/01/2013  15:42             1,162 wsgi.py
21/01/2013  17:42             1,042 wsgi.pyc
21/01/2013  15:42                 0 __init__.py
21/01/2013  17:42               148 __init__.pyc
               8 File(s)         11,411 bytes

     Total Files Listed:
              10 File(s)         11,938 bytes
               8 Dir(s)  10,776,023,040 bytes free

All help will be eagerly anticipated and appreciated,

Thanks,

Miles.


Solution

  • I guess your problem is that there should be no TIMEZONE key in databases setup. If you want to set timezone, add it as a variable outside the DATABASES definition, like this:

    DATABASES = {
        'default' : {
            'ENGINE' = 'django.db.backends.sqlite3',
            'NAME' = 'C:\DOCUMENTS and settings\Miles\My Documents\DjangoExperimentation\mysite\sqlite3.db',
        }
    }
    TIME_ZONE = 'Europe/London'