上一页 1 2 3 4 5 6 7 ··· 10 下一页
摘要: 自动生成接口文档 REST framework可以自动帮助我们生成接口文档。 接口文档以网页的方式呈现。 自动接口文档能生成的是继承自 及其子类的视图。 1. 安装依赖 REST framewrok生成接口文档需要 库的支持。 2. 设置接口文档访问路径 在总路由中添加接口文档路径。 文档路由对应的 阅读全文
posted @ 2019-07-08 19:12 xt12321 阅读(182) 评论(0) 推荐(0) 编辑
摘要: django缓存 一、缓存 1.1 django中的缓存方式 官方文档: 1.2 缓存的配置 :one:开发调试缓存 :two:内存缓存 :three:文件缓存 :four:数据库缓存 :five:Memcache​缓存 使用 python memcached 模块连接 memcache Memca 阅读全文
posted @ 2019-07-08 19:09 xt12321 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 频率控制 一、频率控制实现一 二、自定义频率控制 python 自定义频率类 自定义的,相对较灵活,比较不好的是访问频率单一,修改起来比较麻烦 class MyThrottle(BaseThrottle): VISIT_RECORD = {} def __init__(self): self.his 阅读全文
posted @ 2019-07-04 20:39 xt12321 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 认证组件 权限组件 一、准备内容 二、认证逻辑 三、权限逻辑 阅读全文
posted @ 2019-07-03 23:58 xt12321 阅读(259) 评论(0) 推荐(0) 编辑
摘要: serializer序列化组件 一、models准备 二、序列化的两种方法: 2.1 Serializer 2.2 ModelSerializer 阅读全文
posted @ 2019-07-02 23:49 xt12321 阅读(272) 评论(0) 推荐(0) 编辑
摘要: django 跨域问题 一、问题 二、后端解决跨域问题 使用 django cors headers 中间件 2.1安装 python 1.下载中间件 Install from pip: pip3 install django cors headers 2.配置中间件 INSTALLED_APPS 阅读全文
posted @ 2019-07-01 20:01 xt12321 阅读(645) 评论(0) 推荐(0) 编辑
摘要: (由于markdown语法问题,下面的所有的方法名字前后的——都被识别为加粗语法) | 魔术方法 | 调用方式 | 解释 | | | | | | __new__(cls [,...]) | instance = MyClass(arg1, arg2) | __new__ 在创建实例的时候被调用 | 阅读全文
posted @ 2019-07-01 19:53 xt12321 阅读(204) 评论(0) 推荐(0) 编辑
摘要: RESTful规范 一、restful规范是什么? 二、RESTful API设计 from 阮一峰的blog 三、基于Django实现 阅读全文
posted @ 2019-07-01 19:30 xt12321 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 七、后台管理 后台管理页面: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>BBS论坛</title> <script src="https://cdn.bootcss.com/jquery/3.4.1/j 阅读全文
posted @ 2019-06-28 22:01 xt12321 阅读(1641) 评论(0) 推荐(0) 编辑
摘要: 六、文章详情、点赞、评论 文章详情页面: def article_detail(request, username, article_id): # user_obj = models.UserInfo.objects.filter(username=username) article_obj = m 阅读全文
posted @ 2019-06-28 19:47 xt12321 阅读(854) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 10 下一页