zoukankan      html  css  js  c++  java
  • 使用使用Django认证系统之创建users

    创建users:
    
    Django 从开始就带有一个用户认证系统,它处理用户账号,组,权限以及基于cookie的永不会话
     
    Python 2.7.3 (default, Mar 30 2017, 20:15:12) 
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import os,django
    >>> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
    'mysite.settings'
    >>> django.setup()
    aaaaaaaaaaaaaaaa
    >>> from django.contrib.auth.models import User
    >>> 
     
    node2:/root#cd /django
    You have new mail in /var/spool/mail/root
    node2:/django#cd mysite
    node2:/django/mysite#python
    Python 2.7.3 (default, Mar 30 2017, 20:15:12) 
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import os,django
    >>> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
    'mysite.settings'
    >>> django.setup()
    aaaaaaaaaaaaaaaa
    >>> from django.contrib.auth.models import User
    >>> 
    
    >>> from django.contrib.auth.models import User
    >>> allnavi = User.objects.all()
    >>> allnavi
    <QuerySet [<User: john>, <User: xxxx>, <User: scan>, <User: 015208>, <User: admin>]>
    >>> 
    
    
    mysql> select username from auth_user;
    +----------+
    | username |
    +----------+
    | 015208   |
    | admin    |
    | john     |
    | scan     |
    | xxxx     |
    +----------+
    5 rows in set (0.00 sec)
    
    	
    user = User.objects.create_user('kebo', 'kobe@thebeatles.com', '9999')
    
    >>> user = User.objects.create_user('kebo', 'kobe@thebeatles.com', '9999')
    >>> user.last_name
    u''
    >>> user.username
    u'kebo'
    >>> user.email
    u'kobe@thebeatles.com'
    
  • 相关阅读:
    【sqli-labs】 less23 Error based
    【sqli-labs】 less22 Cookie Injection- Error Based- Double Quotes
    【sqli-labs】 less21 Cookie Injection- Error Based- complex
    【sqli-labs】 less20 POST
    【sqli-labs】 less19 POST
    【sqli-labs】 less18 POST
    【sqli-labs】 less17 POST
    【sqli-labs】 less16 POST
    【sqli-labs】 less15 POST
    nginx.conf(centos7 1.14)主配置文件修改
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348991.html
Copyright © 2011-2022 走看看