0

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.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Miles Bardan
  • 415
  • 3
  • 8
  • 17
  • Why do you need to edit things in DOS? You're in Windows, use one of the many Windows text editors, or even the built-in Notepad if you have to. – Daniel Roseman Jan 22 '13 at 12:50
  • Why do people use terminals/consoles/whatever you name it? Maybe he feels more comfortable working in such an environment. I myself often don't load the window manager of my Debian for days. – rbaleksandar Jan 29 '16 at 20:41

3 Answers3

3

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'
Michael Gendin
  • 3,285
  • 2
  • 18
  • 23
  • 1
    Still, leave TIME_ZONE outside anyway. I see that you have settings.py file both in mysite and mysite/mysite directory. I'm not sure why you need that. In which of this files is the DATABASES setting defined? By the way, the root directory having the same name as your app can bring you some problems, I recommend renaming the root directory – Michael Gendin Jan 22 '13 at 12:16
  • It could be a file permission issue. Try creating the actual sqlite3.db file before you run syncdb. – Nathaniel Jan 22 '13 at 14:43
  • Ahaha Gendin that's it. I was meant to use that settings.py file which already existed inside the mysite/mysite directory.. But I was creating a new one in /mysite. Typing edit mysite/settings.py(as the tutorial said) from /mysite didn't work, I had to cd mysite then edit settings.py..! >.> Cheers. It's such an obvious thing to find really but it's hard to find errors when I've only just started with the tutorial even, like trying to find your phone in a room when you're not sure it's there.. You can only find it once you've made sure it's not in the other places first.. – Miles Bardan Jan 22 '13 at 15:14
  • So many things in this tutorial are really hard to figure out for a beginner though. I'm already stuck again, trying to figure out how to run the command-line client for my database and type .schema >_< It's amazing that there is no one who has broken down and explained this stuff in detail somewhere. – Miles Bardan Jan 22 '13 at 15:27
  • 1
    this actually doesn't have anything to do with Django, that would be in sqlite tutorial. You can look here: http://www.sqlite.org/sqlite.html – Michael Gendin Jan 22 '13 at 22:57
  • 1
    To my mind, djangobook.com tutorial is a bit more comprehensible, but it looks like it hasn't been updated for Django 1.4. By the way, for the same reason disregard my previous comment about renaming root directory - it's ok for the new version of Django. – Michael Gendin Jan 22 '13 at 23:04
1

try replacing 'ENGINE' = 'C:\Django-1.4.3\Django-1.4.3\django\db\backends\sqlite3',

with:

'ENGINE' = 'django.db.backends.sqlite3',

vedarthk
  • 1,253
  • 1
  • 14
  • 34
  • Oops sorry I overlooked the code `TIME_ZONE` should be outside as mentioned by Michael Gendin in his answer. – vedarthk Jan 22 '13 at 12:05
0

"When specifying the path, always use forward slashes, even on Windows (e.g. C:/homes/user/mysite/sqlite3.db)."

https://docs.djangoproject.com/en/1.5/intro/tutorial01/

  • There is no need for you to reply to old, already answered questions. In case you are confused, you can clearly see that the question was asked more than a year ago (22 of January, 2013) and Michael Gendin gave an answer that was accepted as correct (the green check sign) – Hristo Valkanov Jun 07 '14 at 00:09
  • Kk, sorry dude! Didn't mean to offend you, just trying to help – catstronavt Jun 07 '14 at 12:44
  • you didn't offend me, I'm just giving you a tip, since you are new, and many people look down on the type of answer you gave, because of the fore mentioned reasons ;) – Hristo Valkanov Jun 07 '14 at 12:48
  • @HristoValkanov Please note that SE allows reassigning the status "Accepted" of a given answer. This means that unless the topic is locked/closed/deleted everyone is free to post new answers as he/she sees fit and as long as those answers follow the guidelines of SE's posting policy. Even 2-3 years are not that much for a question as long as it is still relevant. I find your comment to go against the very nature of Stackoverflow & Co. and also to be discouraging for newcomers. – rbaleksandar Jan 29 '16 at 20:48