Did you create a superuser when you originally ran syncdb? If so, you can work around the problem in the admin, logged in as that original superuser, making additional superuser through the web.
Have you tried logging in as the "jack" user? The fact that the name is now already taken implies that something was written to the database. You can also test for this in the shell, importing User from django.contrib.auth.models and doing a get or filter with username="jack", and then examine the object, say, by pretty printing it's __dict__. The error is interesting, however. I wonder if it's repeatable. You can rename (or remove) your database file, redo syncdb, then try the createsuperuser. If that fails in the same way, then we could start inserting pdb.set_trace(), say, before line 200 of /usr/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py and poke around inside the Database object there to see what file it's going to try to open, etc. On Thu, Jan 27, 2011 at 7:26 PM, maki maki <mak...@gmail.com> wrote: > 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. >> 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. > -- 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.