我正在尝试学习 Django 并遵循 Django Book 教程,当我在 Python shell 中键入这些行时出现错误:
>>> from django.db import connection
>>> cursor = connection.cursor()
这是我得到的回溯:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python27\lib\site-packages\django\db\backends\__init__.py", line 306,
in cursor
cursor = self.make_debug_cursor(self._cursor())
File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py", line
288, in _cursor
self._sqlite_create_connection()
File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py", line
278, in _sqlite_create_connection
self.connection = Database.connect(**kwargs)
OperationalError: unable to open database file
关于如何解决这个问题的任何想法?在我的 settings.py 上,我DATABASES ENGINE
设置为:django.db.backends.sqlite3
并NAME
设置为:C:\Python27/PythonProjects/mysite
。谢谢!