开发者

Django authentication in django nonrel on GAE

I'm using the Django nonrel project on a google app engine project running locally in development. I've created my own models and these are fine when they are saved and retrieved in the datastore.

I'm hoping to u开发者_JS百科se django.contrib.auth to provide the user functionality. I can use the shell to create users and these get assigned an ID. When I create one of my own models which references User I have to pass in a user ID as it quite rightly fails otherwise.

However, checking via the gae admin interface I can't see the User model in the datastore for the users I've created via the shell. Nor can I retreive the user details from one of my models which references them. Calls to mymodel.user.username return nothing. Nor can I log into admin using the username and password I've set up. I can see saved versions of the models I've made in the gae admin app.

I get the impression that users are being created somewhere other than the datastore. Is there something else I need to do to use the standard contrib.auth users with django-nonrel and gae?


I found the solution and thought I'd post back here just in case anyone comes across this question in future.

I was using the Google App Engine launcher. Django-nonrel makes changes to standard Django. The launcher uses standard Django which doesn't contain these changes. The solution is to use the manage.py runserver which will see all the Django non-rel changes including your own models and the Django contrib ones.


just adding.

I've found out that by using 'python manage.py remote createsuperuser' on a Google App Engine application that uses High Replication database, the change may take some time. That mean you may have to wait several minute before you can login.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜