0

这是我所做的:

> python manage.py createsuperuser
Username (Leave blank to use 'joe'): admin
E-mail address: random_email@yahoo.com
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

当我尝试登录时:http://127.0.0.1:8000/admin/,它一直说用户/密码组合是错误的。我需要启用管理页面的任何特定文件吗?

4

3 回答 3

1

就像 agf 在他的评论中所说的那样,这似乎是一个数据库设置问题。您的模型中定义的内容与 db.xml 中定义的内容之间存在差异。

检查你是否已经跑过./manage.py syncdb或者跑的时候会发生什么./manage.py validate

根据评论更新

App Engine 不支持 Django 模型。您必须使用 App Engine 的 db.models 或 ndb.models API 编写模型。

请参阅此链接:数据存储在 localhost 但不在 gae 数据存储中?

于 2012-05-01T13:24:17.453 回答
0

此外,users[0]不会对整体QuerySet进行评估和缓存。您需要评估整体QuerySet或分配users[0]给某个变量并使用该变量:

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

首领难当啊~

于 2012-05-01T04:50:15.530 回答
0

如果您使用的是 1.6.4 SDK,则存在一个错误,即数据库不保存在 exit() 上。

我相信这在 1.6.5 上是固定的。

于 2012-05-01T01:59:41.967 回答