Django管理员页面

创建管理员账号:

(django-env) D:\Django Projects\mysite>python manage.py createsuperuser
Username: admin
Email address: 
Password: 123456
Password (again): 123456
This password is too short. It must contain at least 8 characters.
This password is too common.
This password is entirely numeric.
Bypass password validation and create user anyway? [y/N]: y
Superuser created successfully.

启动服务器:

(django-env) D:\Django Projects\mysite>python manage.py runserver

进入并登陆管理员页面http://127.0.0.1:8000/admin/
Django管理员页面_第1张图片
修改polls\admin.py,添加Question对象到管理员界面:

from django.contrib import admin

from .models import Question

admin.site.register(Question)

Django管理员页面_第2张图片
然后就可以通过管理员页面来修改Question对象。
Django管理员页面_第3张图片

你可能感兴趣的:(Django学习笔记,Python)