iCodeLikeImDrunk
iCodeLikeImDrunk

Reputation: 17866

why is django not recognizing my admin user/password when i try to log in?

here is what i did:

> python manage.py createsuperuser
Username (Leave blank to use 'joe'): admin
E-mail address: [email protected]
Password:
Password (again):
Superuser created successfully.
Exception AttributeError: "'NoneType' object has no attribute 'mkstemp'" in <bound method DatastoreFileStub.__del__ of <google.appengine.api.datastore_file_stub
.DatastoreFileStub object at 0x02928470>> ignored

> python manage.py shell
[1]: from django.contrib.auth.models import User
[2]: users = User.objects.all()
[3]: users
[3]: [<User: admin>]
[4]: users[0].set_password('password')
[5]: users[0].save()
[6]: exit()
Exeption AttributeError: "'NoneType' object has no attribute 'mkstemp'" in <bound method DatastoreFileStub.__del__ of <google.appengine.api.datastore_file_stub
tastoreFileStub object at 0x028D9490>> ignored

> python manage.py syncbd
Creating tables ...
Installing custom SQL ...
Installing indexes ...
No fixtures found.
Exception AttributeError: "'NoneType' object has no attribute 'mkstemp'" in <bound method DatastoreFileStub.__del__ of <google.appengine.api.datastore_file_stub
.DatastoreFileStub object at 0x02A83310>> ignored

> python manage.py validate
0 errors found
Exception AttributeError: "'NoneType' object has no attribute 'mkstemp'" in <bound method DatastoreFileStub.__del__ of <google.appengine.api.datastore_file_stub
.DatastoreFileStub object at 0x028A3310>> ignored

when i try to log in: http://127.0.0.1:8000/admin/, it keeps saying that the user/pass conbination is wrong. is there any specific files i need to enable admin page?

Upvotes: 0

Views: 580

Answers (3)

super9
super9

Reputation: 30131

Like what agf said in his comment, it looks to be a db setting issue. There's a difference between what's defined in your models and what's defined in the db.

Check to see if you've ran ./manage.py syncdb or what happens when you run ./manage.py validate?

Update Based on Comment

App Engine does not support Django models. You have to write your models using App Engine's db.models or ndb.models API.

See this link: data is stored on localhost but not on gae datastore?

Upvotes: 1

okm
okm

Reputation: 23871

Furthermore, users[0] does not make the whole QuerySet evaluated and cached. You need to evaluate whole QuerySet or assign users[0] to some variable and use the variable:

>>> users[0] is users[0]
False
>>> user = users[0]
>>> user is user
True
>>> len(users); users[0] is users[0]
True

leader难当啊~

Upvotes: 0

dragonx
dragonx

Reputation: 15143

If you're using the 1.6.4 SDK, there's a bug where the database doesn't save on exit().

I believe this is fixed on 1.6.5.

Upvotes: 0

Related Questions