Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » account errors when create superuser on cygwin [RSS Feed]

#1 Jan. 27, 2011 18:46:17

maki m.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

account errors when create superuser on cygwin


hi,

I execute the command: python manage.py createsuperuser --
username=jack --email=j...@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+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 27, 2011 18:59:53

Bill F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

account errors when create superuser on cygwin


I'm not sure whether this is your problem, but file permissions
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 <mak...@gmail.com> wrote:
> hi,
>
>  I execute the command: python manage.py createsuperuser --
> username=jack --email=j...@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+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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Jan. 27, 2011 19:24:12

Daniel R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

account errors when create superuser on cygwin


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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Jan. 28, 2011 00:26:25

maki m.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

account errors when create superuser on cygwin


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)
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)

>>> 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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 Jan. 28, 2011 16:08:37

Bill F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

account errors when create superuser on cygwin


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)
> 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)
>
>>>> 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 athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » account errors when create superuser on cygwin [RSS Feed]

Board footer

Moderator control

Enjoy the 17th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support