4

I got the django-nonrel setup fine, and worked through the first 5 chapters of the djangobook without any real problems. I'm currently on chapter 6 which talks about creating the admin site. http://www.djangobook.com/en/2.0/chapter06/ But, I can't login.

I can get to the admin login page on localhost, but it always says my username and password are incorrect.

Some suggest to "Go into your database and inspect the auth_user table. Make sure that is_staff is set to TRUE on the user you are using to log in." I went into here: "python manage.py shell" And saw that my superuser was there, and that is_staff was true.

I created a superuser with the server running and without it running, and neither one allowed me to login afterwords.

One user (crogjer) suggested the following:

This might be the problem:

You have setup a database for a normal django project. So manage.py createsuperuser will create a superuser in that database.

In case of GAE SKD, it uses the GAE Datastore, so the superuser you created is not present >there.

This is what you could do:

Create a normal user Go to /_ah/admin/ and modify the data for user table in datastore, changing the desired >users is_superuser field to True.

What is the SKD? Does that sound like the answer to my problems? If so, how do I create a normal user?

Here are some of the reference posts I saw: I've looked around at the following posts: Can't login to Django /admin interface django-nonrel google app engine fail to log in admin panel Django-nonrel can't login as super user

Any ideas what I might be doing wrong? Thanks!

Community
  • 1
  • 1
b-ryce
  • 5,752
  • 7
  • 49
  • 79
  • Not really a solution, but running this from a view will allow me to create an admin user: User.objects.create_superuser(username, email, admin) . Thr problem seems to be that the management console and the local dev server don't use the same datastore. – endre Apr 11 '12 at 12:40

1 Answers1

2

I got it. I was running the server through the GoogleAppEngineLauncher when it wasn't working, and I just needed to stop the local server, create the super user, and then run it through

 python manage.py runserver
b-ryce
  • 5,752
  • 7
  • 49
  • 79
  • Surely this wasn't obvious to me too! Run `./manage.py createsuperuser` then next use the `./manage runserver` – JWL Dec 16 '11 at 22:04
  • 2
    I tried everything here, it seems to create the users but doesn't let me log into the localhost admin. Works on the deployed application. – endre Mar 28 '12 at 11:59
  • I also had the same problem. It worked when I stopped the server and created the superuser again. Thanks b-ryce – sufinsha Apr 08 '13 at 10:23