网页中有些需要展示的东西,只能在后台添加,(例如:轮播图),此时需要创建超级管理员账户,进入后台进行相关配置
第一步:

第二步:

第三步:

只要修改了models中的数据模型,一定要先执行makemigrations,再执行migrate
python manage.py makemigrations 创建数据库变更文件
python manage.py migrate 将变更文件应用到数据库
python manage.py createsuperuser 创建超级管理员账户
前三步主要设置后台,后两步主要设置前端展示页面
第四步:

第五步:

网友评论