Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't login to Django /admin interface

First of all, I am a newbie. I'm running Ubuntu 11.04 which comes with Python 2.7 so I installed Python2.5 in different dir to run Django-Non-Rel on Google App Engine. I did the Guestbook tutorial and now I am trying to add admin access but when I type in correct username:password Django thinks its incorrect. It doesn't even work when deployed to GAE. If you know please poke me in the right direction.

I added:

AUTHENTICATION_BACKENDS = ( 
    'django.contrib.auth.backends.ModelBackend', 
)

INSTALLED_APPS = (
    ...
    'django.contrib.admin',
    ....
)

EDIT
I also added

url(r'^admin/', include(admin.site.urls)),

to urls.py in subproject directory.
EOEDIT

Then I created superuser and synced databases:

> python2.5 xxx-xxx-guestbook/manage.py createsuperuser python2.5
> xxx-xxx-guestbook/manage.py syncdb

Then ran the app and can't login. I created multiple different supersusers always with the same result.

EDIT2

Thanks everyone for trying to help but unfortunately neither of the offered solutions fixed the problem. I have decided to first learn Django on its own and then maybe switch to GAE Django-nonrel, so the question is not relevant anymore. Should I still pick one answer to give someone some points?

like image 444
nana Avatar asked Jul 19 '11 17:07

nana


People also ask

Why is my Django admin not working?

'django-admin' is not recognized as an internal or external command, operable program or batch file. To fix this, first close the terminal window and relaunch it with administrator privileges. Once you launch the elevated terminal window change directory to where you wish to start your Django project.

What is the username and password for Django admin?

Run 'python manage.py migrate' to apply them. Username (leave blank to use 'chatru'): admin Email address: [email protected] Password: Password (again): The password is too similar to the username.

How do I find my Django admin?

Run django-admin help to display usage information and a list of the commands provided by each application. Run django-admin help --commands to display a list of all available commands. Run django-admin help <command> to display a description of the given command and a list of its available options.


2 Answers

There is some kind of limitation in django-nonrel.

To create a superuser:

  • Stop the local webserver
  • Create the superuser

    python manage.py createsuperuser
    
  • Run the webserver again

    python manage.py runserver
    
like image 51
David Poblador i Garcia Avatar answered Sep 19 '22 15:09

David Poblador i Garcia


Assuming you have the correct username and password, the only thing that will present the same behavior as a failed login is having is_staff=False for the user in question.

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.

like image 32
Chris Pratt Avatar answered Sep 17 '22 15:09

Chris Pratt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!