• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






守护式等待

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理
上一页 1 ··· 49 50 51 52 53 54 55 56 57 ··· 72 下一页

2019年3月29日

crontab
摘要: linux定时任务 1.1 添加定时任务 crontab -e 1.2 查看cronteb任务 crontab -l 1.3 查看crontab日志 cat /var/log/cron cat /var/log/cron |tail -n 20 # 查看最后20行日志 1.4 crontab 用户操 阅读全文
posted @ 2019-03-29 13:45 守护式等待 阅读(207) 评论(0) 推荐(0)
 

2019年3月28日

ModelSerializer Meta设置
摘要: class AccountSerializer(serializers.ModelSerializer): class Meta: # 模型名称 model = User # 序列化返回的字段 fields = ('id', 'account_name', 'users', 'created') # 这个字段... 阅读全文
posted @ 2019-03-28 16:47 守护式等待 阅读(931) 评论(0) 推荐(0)
 
Serializer fields
摘要: 1.导入 field参数 1.read_only read_only=True 表示不允许用户自己上传,只能用于api的输出,序列化的时候也不用对这个数据进行验证,序列化返回是有改字段 2.write_only write_only=True 表示在更新或创建实例时可以使用该字段,但在序列化返回时不 阅读全文
posted @ 2019-03-28 15:20 守护式等待 阅读(264) 评论(0) 推荐(0)
 
django-rest-framework配置json web token
摘要: 安装jwt库,简单快速的生成我们所需要的token 1.安装djangorestframe pip install djangorestframe 2.在settings.py的INSTALLED_APPS中加入: INSTALLED_APPS = [ ... 'rest_framework', ' 阅读全文
posted @ 2019-03-28 14:01 守护式等待 阅读(1411) 评论(0) 推荐(0)
 
rest_framework_extensions实现缓存
摘要: 1.安装包 2.配置redis 3.配置drf-extensions 4.简单使用 阅读全文
posted @ 2019-03-28 13:29 守护式等待 阅读(1006) 评论(0) 推荐(0)
 
rest_framework常用设置
摘要: 1.常用配置 import django_filters # contacts 模糊查询 i表示忽然大小写 name = django_filters.CharFilter(name='name', lookup_expr='icontacts') 2.获取user 3.返回数据 4.rest fr 阅读全文
posted @ 2019-03-28 13:21 守护式等待 阅读(606) 评论(0) 推荐(0)
 

2019年3月21日

django AnonymousUser
摘要: AnonymousUser对象class models.AnonymousUser django.contrib.auth.models.AnonymousUser是一个实现django.contrib.auth.models.User接口的类,具有以下差异: id始终是None。username  阅读全文
posted @ 2019-03-21 15:56 守护式等待 阅读(2704) 评论(0) 推荐(0)
 

2019年3月18日

获取视频时长和文件大小
摘要: import os from moviepy.editor import VideoFileClip import pymysql file_dir = ".\\video" # 定义文件目录 class FileCheck(object): def __init__(self): self.file_dir = file_dir def get_fi... 阅读全文
posted @ 2019-03-18 17:06 守护式等待 阅读(1440) 评论(0) 推荐(0)
 

2019年3月14日

xadmin增加用户 除了账号和密码 添加其他信息
摘要: 默认xadmin在添加账号的时候只有账号和密码 我们可以添加其他信息 打开源码 xadmin -> plugins -> auth -> 找到self.form = UserCreationForm 如果找到UserCreationForm函数 a 阅读全文
posted @ 2019-03-14 10:31 守护式等待 阅读(1280) 评论(1) 推荐(0)
 

2019年3月11日

Django 重写用户模型
摘要: AUTH_USER_MODEL = 'myapp.MyUser' django——重写用户模型 Django内建的User模型可能不适合某些类型的项目。例如,在某些网站上使用邮件地址而不是用户名作为身份的标识可能更合理。 1.修改配置文件,覆盖默认的User模型 Django允许你通过修改setti 阅读全文
posted @ 2019-03-11 17:13 守护式等待 阅读(1130) 评论(0) 推荐(0)
 
上一页 1 ··· 49 50 51 52 53 54 55 56 57 ··· 72 下一页