1、用户认证组件

用户认证组件:

    功能:用session记录登录验证状态
    
    前提:用户表:django自带的auth_user
    
    创建超级用户: python3 manage.py createsuperuser

  

创建超级用户

C:\PycharmProjects\authdemo>python manage.py createsuperuser
Username (leave blank to use 'venicid'): alex
Email address:  # 空
Password:       1234
Password (again):  
This password is too short. It must contain at least 8 characters.
This password is entirely numeric.
Password:       12345678
Password (again):
This password is too common.
This password is entirely numeric.
Password:       qwerasdf
Password (again):
Superuser created successfully.

  06 django的用户认证组件06 django的用户认证组件

 

  不能像一般取数据库中的数据,密码是密文的

06 django的用户认证组件

 

  2、auth模块详细代码

from django.contrib import auth

#django.contrib.auth中提供了许多方法,这里主要介绍其中的三个:

 

创建超级用户

C:\PycharmProjects\authdemo>python manage.py createsuperuser
Username (leave blank to use 'venicid'): alex
Email address:  #
Password:       1234
Password (again):  
This password is too short. It must contain at least 8 characters.
This password is entirely numeric.
Password:       12345678
Password (again):
This password is too common.
This password is entirely numeric.
Password:       qwerasdf
Password (again):
Superuser created successfully.
View Code

相关文章:

  • 2022-12-23
  • 2021-09-13
  • 2022-01-12
  • 2022-12-23
  • 2021-07-25
  • 2021-06-14
  • 2021-12-25
猜你喜欢
  • 2022-02-03
  • 2021-08-19
  • 2021-08-09
  • 2021-05-30
  • 2021-08-29
  • 2022-12-23
相关资源
相似解决方案