所以,我在这里(数据库设置)在 Django 教程“编写你的第一个 Django 应用程序,第 1 部分”。到目前为止一切都很好,但现在我被卡住了。
我进入 DOS 的外部 mysite 目录,然后输入“edit settings.py”。这将在外部 mysite 目录中创建一个名为“settings.py”的新文件,并打开一个蓝色的 DOS 文本编辑器框,该框完全为空。在这个框中,我尝试输入各种内容,保存并退出。如果我再次输入edit settings.py,保存的文本仍然存在,应该是。
我不能从这个蓝色的 DOS 文本编辑器复制或粘贴,所以我必须在那里输入所有内容,现在在这里手动输入。
我目前在 mysite/settings.py 中拥有的是这个(虽然,我尝试过多种方式输入信息,例如引擎的“django.db.backends.sqlite3”,并将其输入为“DATABASE_ENGINE”等... :
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'
}
}
保存并退出后,然后输入“python manage.py syncdb”,我收到的消息,幸运的是我可以复制它,因为它当然是在主 DOS 窗口中,如下所示:
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.
(顺便说一句......在stackoverflow中有什么方法可以标记为代码而不单独缩进每一行? - 我已经计算出复制/粘贴四个空格)
所以,帮助..拜托?我在这里做错了什么?
这是我正在尝试执行此操作的整个 'djangoExperimentation' 目录的读数:
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
所有的帮助都将受到热切期待和赞赏,
谢谢,
迈尔斯。