Django 官方教程翻译项目php 和 .asp 之类的冗余的后缀放到 URL 里。 为了设计你自己的 URL,你需要创建一个叫做 URLconf 的 Python 模块。一张包含 URL 匹配模 式和 Python 回调函数之间的映射表。URLconf 也有利于将 Python 代码与 URL 解耦合(译 注:使各个模块分离,独立)。 下面这个 URLconf 适用于前面 Reporter/Article 的例子: url(r'^articles/([0-9]{4})/([0-9]{2})/([0-9]+)/$', views.article_detail), 11. ] 上面的代码将 URL 的正则表达式映射到 views 里的回调函数。正则表达式通过括号来提取 URL 中的参数值。当一个用户请求页面时,Django 会顺序遍历这些匹配模式,直至模式和请求的 URL 成功匹配。(如果全部模式都无法匹配,Django 会返回一个404视图。)这个过程会在瞬间完成, Python 函数。视图会被传进一个请求(requeset)对象——其中包含了请求元数据——和正则表达式匹配到的 那些参数值。 比如,如果用户请求了“/articles/2005/05/39323/”这样的 URL,Django 就会这样调用函 数:news.views.article_detail(request, ‘2005’, ‘05’, ‘39323’)。 视图函数的执行结果只可能有两种:返回一个包含请求页面内容的0 码力 | 103 页 | 1.86 MB | 1 年前3
 Django、Vue 和Element UI 前后端原理论述后端开发(Django+Rest Framework+MySQL): Django 负责处理 HTTP 请求和响应,以及 URL 路由的配置。它接收来自前端的 HTTP 请求,并根据 URL 将请求分发给相应的视图函数进行处理。 Rest Framework 是 Django 的扩展,用于快速构建 RESTful API 接口。通过 Rest Framework,可以定义 API 视图和序列化器,实现数据的序列化和反序列化,从而方便地 数据反序列化为数据对象,便于在后端进行 处理。 视图:DRF 提供了各种视图类,用于处理 API 请求,并返回适当的响应。包括基于 函数的视图和基于类的视图,还有通用视图和视图集等。 路由:DRF 提供了灵活的路由功能,用于将 API 请求映射到相应的视图处理函数上。 认证和权限:DRF 支持各种认证和权限控制方式,可以保护 API 的安全性。 分页和过滤:DRF 提供了分页和过滤功能,便于处理大量数据和筛选查询结果。 Bito 输出面板中自动生成对于选中代码的按行注解。 2) 以“生成注释”为例 同样的,选中代码,点击 Bito 面板的”generate comment”功能,即可在输出面板看 到对选中代码函数功能的注解。 11 《51 测试天地》七十四 www.51testing.com 除此之外呢?“性能检查”可以帮助开发人员检查出代码中潜藏的性能问题,并且 提出相应的代码修改样例,可以一键解决代码性能问题,如下图所示。0 码力 | 61 页 | 6.84 MB | 1 年前3
 Django Q Documentation
Release 0.7.9this should probably not be your first choice for a high traffic setup. However for a medium message rate and scheduled tasks, this is the most convenient guaranteed delivery broker. Delivery receipts Supports management command: $ python manage.py qinfo All stats are summed over all available clusters. Task rate is calculated over the last 24 hours and will show the number of tasks per second, minute, hour or0 码力 | 62 页 | 514.67 KB | 1 年前3
 Django Q Documentation
Release 0.7.9this should probably not be your first choice for a high traffic setup. However for a medium message rate and scheduled tasks, this is the most convenient guaranteed delivery broker. • Delivery receipts management command: $ python manage.py qinfo All stats are summed over all available clusters. Task rate is calculated over the last 24 hours and will show the number of tasks per second, minute, hour or0 码力 | 50 页 | 397.77 KB | 1 年前3
 Django Q Documentation
Release 0.7.13this should probably not be your first choice for a high traffic setup. However for a medium message rate and scheduled tasks, this is the most convenient guaranteed delivery broker. • Delivery receipts management command: $ python manage.py qinfo All stats are summed over all available clusters. Task rate is calculated over the last 24 hours and will show the number of tasks per second, minute, hour or0 码力 | 56 页 | 416.37 KB | 1 年前3
 Django Q Documentation
Release 0.7.11this should probably not be your first choice for a high traffic setup. However for a medium message rate and scheduled tasks, this is the most convenient guaranteed delivery broker. • Delivery receipts management command: $ python manage.py qinfo All stats are summed over all available clusters. Task rate is calculated over the last 24 hours and will show the number of tasks per second, minute, hour or0 码力 | 54 页 | 412.45 KB | 1 年前3
 Django Q Documentation
Release 0.7.10this should probably not be your first choice for a high traffic setup. However for a medium message rate and scheduled tasks, this is the most convenient guaranteed delivery broker. Delivery receipts Supports management command: $ python manage.py qinfo All stats are summed over all available clusters. Task rate is calculated over the last 24 hours and will show the number of tasks per second, minute, hour or0 码力 | 67 页 | 518.39 KB | 1 年前3
 Django Q Documentation
Release 0.7.12this should probably not be your first choice for a high traffic setup. However for a medium message rate and scheduled tasks, this is the most convenient guaranteed delivery broker. • Delivery receipts management command: $ python manage.py qinfo All stats are summed over all available clusters. Task rate is calculated over the last 24 hours and will show the number of tasks per second, minute, hour or0 码力 | 56 页 | 415.46 KB | 1 年前3
 Django Q Documentation
Release 0.7.10this should probably not be your first choice for a high traffic setup. However for a medium message rate and scheduled tasks, this is the most convenient guaranteed delivery broker. • Delivery receipts management command: $ python manage.py qinfo All stats are summed over all available clusters. Task rate is calculated over the last 24 hours and will show the number of tasks per second, minute, hour or0 码力 | 52 页 | 406.50 KB | 1 年前3
 Django Q Documentation
Release 0.7.17this should probably not be your first choice for a high traffic setup. However for a medium message rate and scheduled tasks, this is the most convenient guaranteed delivery broker. • Delivery receipts management command: $ python manage.py qinfo All stats are summed over all available clusters. Task rate is calculated over the last 24 hours and will show the number of tasks per second, minute, hour or0 码力 | 56 页 | 416.84 KB | 1 年前3
共 77 条
- 1
 - 2
 - 3
 - 4
 - 5
 - 6
 - 8
 













