Site management
The site is divided into two parts: content release and public access
Content release
The administrator is responsible for viewing, adding, modifying, and deleting data
Login site: http://127.0.0.1:8000/admin
1. Localization of the management interface
Use local habits for the language, time, etc. displayed in the project directory/settings.py with the same name
(Here is Chinese, that is, Simplified Chinese is used, and the Asian/Shanghai time zone is set)
LANGUAGE_CODE = 'en-us' ---→ 'zh-Hans'
TIME_ZONE = 'UTC' ---→ 'Asia/Shanghai'
2. Create an administrator
Create an administrator (input user name, email, password as prompted)
python manage.py createsuperuser
reset Password
python manager.py changepassword 用户名
3. Register the model class
Register the model class in the admin.py file of the application. If it is not imported, there is no management entry in the site interface
# 导入模型
from book.models(子应用中的models文件) import 模型类名
# 注册模型类
admin.site.register(模型类名)
4. Publish content to the database
Use the admin interface to manage the database