Thanks for your replies. I had runned `manage.py syncdb` and the db file exists.
I can open the db file in django's manage shell: >>> f = open('./data/db.db') >>> f <open file './data/db.db', mode 'r' at 0x7faa0230> the permission of the db file is :-rwxrwxrwx the version of python on cygwin is Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01) [GCC 4.3.4 20090804 (release) 1] on cygwin also, I can use the APIs of models in manage shell, and sqlite3 can be imported. >>> from polls.models import Poll >>> Poll.objects.filter(id=1) [<Poll: what's up?>] >>> import sqlite3 >>> exit() but the error occurred when i run "python manage.py createsuperuser --username=jack --email=j...@f.com". although the error occurred, if i run the command again, it prompt: 'Error: That username is already taken.' On Fri, Jan 28, 2011 at 3:24 AM, Daniel Roseman <dan...@roseman.org.uk>wrote: > On Thursday, January 27, 2011 6:42:29 PM UTC, maki maki wrote: > >> hi, >> >> I execute the command: python manage.py createsuperuser -- >> username=jack --email=ja...@f.com >> >> and an error occurred: >> >> Traceback (most recent call last): >> File "manage.py", line 11, in <module> >> <snip> >> >> File "/usr/lib/python2.6/site-packages/django/db/backends/sqlite3/ >> base.py", line 200, in execute >> return Database.Cursor.execute(self, query, params) >> django.db.utils.DatabaseError: unable to open database file >> >> >> the database in settings.py is like this: >> >> DATABASES = { >> 'default': { >> 'ENGINE': 'django.db.backends.sqlite3', # Add >> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. >> 'NAME': '/home/jack/django/mysite/data/ >> db.db', # Or path to database file if using >> sqlite3. >> 'USER': '', # Not used with sqlite3. >> 'PASSWORD': '', # Not used with sqlite3. >> 'HOST': '', # Set to empty string for >> localhost. Not used with sqlite3. >> 'PORT': '', # Set to empty string for >> default. Not used with sqlite3. >> } >> } >> >> can someone tell me why the error occurred? Thanks. >> > > Have you run `manage.py syncdb` first? You need that to create the db and > the tables. > -- > DR. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.