I did what the django tutorial said, but i still couldn’t log in the localhost:8000/admin/
using the user I created. I check the database, there is no username ‘admin’.
I created the user by :
from django.contrib.auth.models import User
u = User.objects.get(username__exact='john')
u.set_password('new password')
u.save()
Can anyone helps me ? please.
syncdb in general creates/updates the database, so from your statement:
I understand you must have somehow created your database. The first time you run syncdb you will be asked to create a super user. Right there you should insert your credentials.
However, if you lost this part you could later on use the django shell:
This will open a python shell with your django environment loaded. In that shell create the admin user as follows:
Note that *is_staff* must be true for your new user to be able to login in the admin area
and *is_superuser* must also be true for the user to have all permissions.
Then go to localhost:8000/admin/ and login with your new ‘admin’ user.