配置
在项目的app中有admin.py文件
在此文件中导入我们写好的models并配置
from django.contrib import admin # Register your models here. from blog.models import * admin.site.register(Article) admin.site.register(UserInfo) admin.site.register(Blog) admin.site.register(Tag) admin.site.register(HomeCategory) admin.site.register(Comment) admin.site.register(ArticleUpDown) admin.site.register(ArticleDetail) admin.site.register(Article2Tag)
创建超级用户
manage.py@BlogYuan > createsuperuser "C:\Program Files\JetBrains\PyCharm 2017.1.2\bin\runnerw.exe" C:\Python36\python.exe "C:\Program Files\JetBrains\PyCharm 2017.1.2\helpers\pycharm\django_manage.py"
createsuperuser C:/Users/Administrator/PycharmProjects/yangxt/day78/BlogYuan Username: root Email address: Warning: Password input may be echoed. Password: root1234 Warning: Password input may be echoed. Password (again): root1234 Superuser created successfully. Following files were affected Process finished with exit code 0
访问admin页面
使用超级用户登录
此时我们便可以很方便的往我们创建的数据库表中添加数据了