创建超级用户
python manage.py createsuperuser
注册模型,blog/admin.py
from django.contrib import admin from blog.models import Post admin.site.register(Post)
注册之后就可以在网页上管理模型数据库了
还可以设定表头的显示等
class PostAdmin(admin.ModelAdmin): list_display = ['title', 'date', 'author'] ordering = ['date'] admin.site.register(Post, PostAdmin)