Forums

Error login at the admin Django administration page

Hi everybody.

I'm taking the free Django course with Prof. Charles Severance (Dr. Chuck), and at Lesson 6, I am having some troubles to login at the admin page of django, i.e. I created successfully the username and the password, but at the moment to enter I receive this message " Please enter the correct username and password for a staff account. Note that both fields may be case-sensitive. " .

source page: http://djtutorial.dj4e.com/admin

It sounds like you may not be entering the username/password correctly; you can change the password to make sure that it's exactly what you want by using the command

python manage.py changepassword <username>

...replacing the <username> with the actual username of the admin account that you created.

Thanks, but the problem persist, I've already did what you say but I still received the same message "Please enter the correct username and password for a staff account. Note that both fields may be case-sensitive".

The username is correct: I change the password successfully.

I do not know what happen.

I have run the python manage.py check and everything is ok.

I am using the Dr chuck's link "http://djtutorial.dj4e.com/admin" to login, because he said I can not use the runserver cmd line in pythonanywhere, so that, I run the manage.py cmd and then reload the web page, but the problem is still there.

When I try to connect within the local host the page does not connect, so, I have to use http://djtutorial.dj4e.com/admin.

I really do not know the solution.

Are you sure that the user you're trying to log in as is marked as staff in your database?

Well, I think so. How can I verify that?

Check that the is_staff field is true in your database.

is actually set "is_staff=1"

I have already check the username and the password with the following cmds:

from django.contrib.auth.models import User
user = User.objects.get(username='username')
user.check_password('password')
TRUE

What can I do?

What is the relation between the code you run above and djtutorial.dj4e.com web app? We do not know the details of Dr. Severance course.

Hi - this is Chuck :)

First you can never use runserver on PythonAnywhere. My instructions at https://dj4e.com/assn/dj4e_install.md say:

Just as a note, you never run the runserver command on PythonAnywhere. This functionality is replaced by the "reload" button on your Web tab. So if you are reading any Django instructions that say to do a runserver, instead do a check and then reload the application in the Pythonanywhere web UI.

Also you will never use localhost - in order to test, you need to connect to the web server at the URL that is shown under the Web tab in your PythonAnywhere user interface.

What it looks like you are doing is getting the password set on your PythonAnywhere site using changepassword - but then trying to log into my PythonAnywhere site at http://djtutorial.dj4e.com/admin using your password - which won't work.

Please read the instructions in the assignment carefully. Once you understand the differences between running Django locally and on PythonAnywhere in this first assignment, it will be second nature in later assignments.

It's a pleasure to me to receive instructions coming from you (Dr. Chuck), sorry for the mistake, I am not an expert, I just want to learn. I am from Venezuela.

The problem has been solved, I did what you said (Dr. Chuck), login successfully.

Thanks Dr. Chuck and Thanks all of you guys that really help to understand.

Best regards!!!!!

Kendel Ibarra.

Glad to help. We might as well get some of these answers in the PythonAnywhere forums in case folks come and search.