After opening the session, next:
First, in settings. py, open the auth, contenttypes, sessions, and Admin applications. The red part of the code is as follows:
Installed_apps = (
'Django. contrib. auth ',
'Django. contrib. contenttypes ',
'Django. contrib. session ',
# 'Django. contrib. Sites ',
# 'Django. contrib. Messages ',
# 'Django. contrib. staticfiles ',
# Uncomment the next line to enable the admin:
'Django. contrib. admin ',
# Uncomment the next line to enable admin documentation:
# 'Django. contrib. admindocs ',
)
Ü Add the following content in the header when modifying URLs. py:
From Django. contrib import Admin
Admin. autodiscover ()
Then add the urlpattern of admin: (R' ^ admin/', include (Admin. Site. URLs). For more information, see section 2.3.1.
Remember the previous Python manage. py syncdb? Run the command to create the admin and Auth database tables (the premise is settings. in py, data_base must be correctly configured.) in this process, you will be asked to create an administrator account. If no Administrator account is created, you can manually run $ Python manage. create py createsuperuser again:
The procedure for creating a database table is as follows:
Creating tables...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table auth_message
Then you can access
$ Python manage. py MAID: 8000
Http: // 10.1.1.159: 8000/admin/
You can see the built-in login management interface of Django. Enter the username and password of the Administrator you just created to add a user and change the permissions. If you are an english user, you only need to modify settings. in py, you can see the Chinese management interface. For example:
More can refer to: https://docs.djangoproject.com/en/1.5/ref/contrib/admin/