Use Django backend management system

Use django backend management system

Check the configuration file

img

img

Check the root file urls.py

img

Start the project, the browser input port ip / admin as: 127.0.0.1/8000/admin Enter

img

Registration Super background management system management

img

1.create    # 创建普通用户,密码明文(不推荐)
2.create_user   # 创建普通用户,密码密文(推荐)
3.createsuperuser   # 创建超级用户(推荐)


#命令语句
python manage.py createsuperuser 

Username (leave blank to use '7981-python'):root#不输入默认使用'7981-python'
    
Email address:#邮箱地址选填
    
Password:#最少8位,不能是纯数字/字符
    
Password(again):#确认密码,在输一遍

Superuser created successfully.#表示超级用户注册成功    

Login account and password

img

Add the database tables to the back-end management system, easy to view

img

Background management system is provided, the field value can be null

img

img

img

img

img

img

img

  • Note: Setting the background field value management effect is empty, an empty character string is written in the database, in general, blank = True, null = True are used together, preventing data corruption

Modify the field display name back office systems

img

img

img

Whether to set a field may be changed back office systems

img

Prompted to fill in the information field value

img

img

Set Background management system can modify the field value option

img

img

img

Modify the table name information

img

img

Use rich text editor

# 富文本编辑器作用: 编写出来漂亮,带格式的文本信息 
1.安装模块 
- pip3 install django-tinymce==2.6.0

2.settings.py配置文件 INSTALLED_APPS 添加编辑器应用
INSTALLED_APPS = (
    ......,
    'tinymce', #注册富文本编辑器
)

3.在settings.py中添加编辑配置
TINYMCE_DEFAUL_CONFIG = {
    'theme':'advanced', # 富文本功能
    'width':600,        # 宽
    'height':400,       # 高
}

4.根urls.py中配置url (要使用路由分发)
urlpatterns = [
    ......,
    url(r'^tinymce/',include('tinymce.urls')),
]

5.models中应用,注册使用admin就可以使用了 

img

img

img

Guess you like

Origin www.cnblogs.com/guyouyin123/p/12215816.html