• 运维开发笔记整理-创建django用户


                运维开发笔记整理-创建django用户

                                       作者:尹正杰

    版权声明:原创作品,谢绝转载!否则将追究法律责任。

    一.创建普通用户

    C:UsersyinzhengjiesoftwaresPycharmProjectDevOps>python manage.py shell
    Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    (InteractiveConsole)
    >>>
    >>>
    >>> from django.contrib.auth.models import User      
    >>>
    >>> user = User.objects.create_user("yinzhengjie", "yinzhengjie@yinzhengjie.org.cn", "123")
    >>>

     

    二.创建管理员

    C:UsersyinzhengjiesoftwaresPycharmProjectDevOps>python manage.py createsuperuser
    Username: admin
    Email address: admin@yinzhengjie.org.cn
    Password:
    Password (again):
    Superuser created successfully.
    
    C:UsersyinzhengjiesoftwaresPycharmProjectDevOps>
    C:UsersyinzhengjiesoftwaresPycharmProjectDevOps>

     

    三.修改用户名的密码

    1>.在数据库中查看刚刚创建的2个用户信息

    mysql> select * from auth_userG

    2>.进入Django自带的shell环境修改密码 

    C:UsersyinzhengjiesoftwaresPycharmProjectDevOps>python manage.py shell
    Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    (InteractiveConsole)
    >>> from django.contrib.auth.models import User
    >>>
    >>>
    >>> u = User.objects.get(username='yinzhengjie')
    >>>
    >>> u.set_password('7474741')
    >>>
    >>> u.save()
    >>>
    >>>

  • 相关阅读:
    Angular——事件指令
    Angular——数据绑定
    Angular——自定义指令
    Angular——表单指令
    Angular——引入模板指令
    Angular——内置指令
    Angular——基本使用
    Canvas——基本入门
    JS高级——面向对象方式解决tab栏切换问题
    JS高级——面向对象方式解决歌曲管理问题
  • 原文地址:https://www.cnblogs.com/yinzhengjie/p/10246850.html
Copyright © 2020-2023  润新知