I've set up a new project, and populated it with simple models. (Essentially I'm following the tut.)
When I run python manage.py shell
on the command line, it works fine:
>python manage.py shell
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from mysite.myapp.models import School
>>> School.objects.all()
[]
Works great. Then, I try to do the same thing in Eclipse (using a Django project that is composed of the same files.)
Right click on mysite project >> Django >> Shell with Django environment
This is the output from the PyDev Console:
>>> import sys; print('%s %s' % (sys.executable or sys.platform, sys.version))
C:\Python26\python.exe 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)]
>>>
>>> from django.core import management;import mysite.settings as settings;management.setup_environ(settings)
'path\\to\\mysite'
>>> from mysite.myapp.models import School
>>> School.objects.all()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python26\lib\site-packages\django\db\models\query.py", line 68, in __repr__
data = list(self[:REPR_OUTPUT_SIZE + 1])
File "C:\Python26\lib\site-packages\django\db\models\query.py", line 83, in __len__
self._result_cache.extend(list(self._iter))
File "C:\Python26\lib\site-packages\django\db\models\query.py", line 238, in iterator
for row in self.query.results_iter():
File "C:\Python26\lib\site-packages\django\db\models\sql\query.py", line 287, in results_iter
for rows in self.execute_sql(MULTI):
File "C:\Python26\lib\site-packages\django\db\models\sql\query.py", line 2368, in execute_sql
cursor = self.connection.cursor()
File "C:\Python26\lib\site-packages\django\db\backends\__init__.py", line 81, in cursor
cursor = self._cursor()
File "C:\Python26\lib\site-packages\django\db\backends\sqlite3\base.py", line 170, in _cursor
self.connection = Database.connect(**kwargs)
OperationalError: unable to open database file
What am I doing wrong here?