can be fussy with Windows. You might try going into the
manage.py shell and trying to open the file with python's
open builtin, e.g., if the database file already exists:
f = open('path_to/db_file')
or if it doesn't:
f = open('path_to/db_file', 'w)
Permission problems can be subtle. The place I've been bitten
was a native windows install of apache2 not being willing to use
configuration files edited with a tool under cygwin. When I found
a suitable cacls tool, it seemed that the cygwin library created
files with a funky set of permissions, which, while equivalent to
a much simpler set of permissions, worked for most applications,
but apache was very fussy.
It is also possible that sqlite isn't correctly installed. IIRC it's built
into recent pythons, but I don't what python you're using. Older
versions require you to install it separately.
On Thu, Jan 27, 2011 at 1:42 PM, maki maki <makicn@gmail.com> wrote:
> hi,
>
> I execute the command: python manage.py createsuperuser --
> username=jack --email=jack@f.com
>
> and an error occurred:
>
> Traceback (most recent call last):
> File "manage.py", line 11, in <module>
> execute_manager(settings)
> File "/usr/lib/python2.6/site-packages/django/core/management/
> __init__.py", line 438, in execute_manager
> utility.execute()
> File "/usr/lib/python2.6/site-packages/django/core/management/
> __init__.py", line 379, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
> File "/usr/lib/python2.6/site-packages/django/core/management/
> base.py", line 191, in run_from_argv
> self.execute(*args, **options.__dict__)
> File "/usr/lib/python2.6/site-packages/django/core/management/
> base.py", line 220, in execute
> output = self.handle(*args, **options)
> File "/usr/lib/python2.6/site-packages/django/contrib/auth/
> management/commands/createsuperuser.py", line 133, in handle
> User.objects.create_superuser(username, email, password)
> File "/usr/lib/python2.6/site-packages/django/contrib/auth/
> models.py", line 133, in create_superuser
> u.save(using=self._db)
> File "/usr/lib/python2.6/site-packages/django/db/models/base.py",
> line 456, in save
> self.save_base(using=using, force_insert=force_insert,
> force_update=force_update)
> File "/usr/lib/python2.6/site-packages/django/db/models/base.py",
> line 522, in save_base
> rows = manager.using(using).filter(pk=pk_val)._update(values)
> File "/usr/lib/python2.6/site-packages/django/db/models/query.py",
> line 497, in _update
> return query.get_compiler(self.db).execute_sql(None)
> File "/usr/lib/python2.6/site-packages/django/db/models/sql/
> compiler.py", line 866, in execute_sql
> cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
> File "/usr/lib/python2.6/site-packages/django/db/models/sql/
> compiler.py", line 732, in execute_sql
> cursor.execute(sql, params)
> File "/usr/lib/python2.6/site-packages/django/db/backends/util.py",
> line 15, in execute
> return self.cursor.execute(sql, params)
> 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.
>
> --
> 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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment