随笔分类 -  django

django
摘要:第一步 在登录类中生成 jwt class Login(MyException,APIView): def post(self,request): user_obj = models.UserInfo.objects.filter(**request.data).first() if not use 阅读全文
posted @ 2024-04-22 15:49 李瑞鑫 阅读(26) 评论(0) 推荐(0) 编辑
摘要:django 操作记录入库 阅读全文
posted @ 2021-11-04 17:19 李瑞鑫 阅读(563) 评论(0) 推荐(0) 编辑
摘要:在 manage.py 同级目录 创建 uwsgi.ini 文件 ,内容如下: nginx vhost 中创建 django.conf 文件 安装 uwsgi 模块 /usr/local/python3/bin/pip3 install uwsgi 启动项目 /usr/local/python3/b 阅读全文
posted @ 2019-03-21 22:00 李瑞鑫 阅读(5421) 评论(0) 推荐(0) 编辑
摘要:django orm choice字段 阅读全文
posted @ 2018-11-11 12:01 李瑞鑫 阅读(2460) 评论(1) 推荐(0) 编辑
摘要:Django REST framework 是用于构建Web API 的强大而灵活的工具包。 我们可能想使用REST框架的一些原因: Web浏览API对于开发人员来说是一个巨大的可用性。 认证策略包括OAuth1a和OAuth2的包。 支持ORM和非ORM数据源的序列化。 如果你不需要更强大的功能, 阅读全文
posted @ 2018-06-01 10:50 李瑞鑫 阅读(25450) 评论(0) 推荐(0) 编辑
摘要:创建django的model时,有DateTimeField、DateField和TimeField三种类型可以用来创建日期字段,其值分别对应着datetime()、date()、time()三中对象。这三个field有着相同的参数auto_now和auto_now_add,表面上看起来很easy, 阅读全文
posted @ 2017-11-23 10:19 李瑞鑫 阅读(9504) 评论(0) 推荐(0) 编辑
摘要:django定时任务之crontab 阅读全文
posted @ 2017-09-19 10:23 李瑞鑫 阅读(678) 评论(0) 推荐(0) 编辑
摘要:from concurrent.futures import ThreadPoolExecutor,ProcessPoolExecutor import time def task(i): print(i) time.sleep(1) pool = ThreadPoolExecutor(10) for index in range(66): pool.submit(t... 阅读全文
posted @ 2017-06-05 14:01 李瑞鑫 阅读(161) 评论(0) 推荐(0) 编辑
摘要:#q条件from django.db.models import Qq = Q(name__startswith="p") | Q(name__startswith="l") #or条件v =models.Book.objects.filter(q).values("name")print(v)#匹 阅读全文
posted @ 2017-03-19 13:31 李瑞鑫 阅读(1129) 评论(0) 推荐(0) 编辑
摘要:简单 models 操作 阅读全文
posted @ 2017-02-23 00:20 李瑞鑫 阅读(160) 评论(0) 推荐(0) 编辑
摘要:html示例 views函数设置 阅读全文
posted @ 2017-02-04 10:30 李瑞鑫 阅读(159) 评论(0) 推荐(0) 编辑
摘要:session应用示例 settings文件内配置 Django默认支持Session,并且默认是将Session数据存储在数据库中,即:django_session 表中。 a. 配置 settings.py SESSION_ENGINE = 'django.contrib.sessions.ba 阅读全文
posted @ 2017-01-12 00:11 李瑞鑫 阅读(8000) 评论(0) 推荐(0) 编辑
摘要:示例1 示例2 基于装饰器实现用户认证 阅读全文
posted @ 2017-01-10 23:44 李瑞鑫 阅读(2272) 评论(0) 推荐(0) 编辑
摘要:分页插件使用手册: 1.在APP同级目录创建 utils目录 2.在utils目录内创建 pagination.py文件,把上边的代码复制进去 3.视图函数调用示例。 1 def host(request): 2 if request.method == "GET": 3 host_list = m 阅读全文
posted @ 2017-01-10 17:20 李瑞鑫 阅读(292) 评论(0) 推荐(0) 编辑
摘要:- 自定义函数 simple_tag a. app下创建templatetags目录 b. 任意xxoo.py文件 c. 创建template对象 register d. __author__ = 'Administrator'from django import templatefrom djan 阅读全文
posted @ 2017-01-08 23:07 李瑞鑫 阅读(1848) 评论(0) 推荐(0) 编辑
摘要:外键约束示例 注意: server_group 是一个对象 里边封装了id和caption,如果想取 caption可以通过如下方法: for row in list row.servername row.serverip row.server_group.caption 阅读全文
posted @ 2017-01-05 22:41 李瑞鑫 阅读(568) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示