Django 官方教程翻译项目你的团队(或者客户)就可以向网站里填充数据了。后面我们会谈到如何展示这些数据。 简洁优雅的 URL 规划对于一个高质量 Web 应用来说至关重要。Django 推崇优美的 URL 设计, 所以不要把诸如 .php 和 .asp 之类的冗余的后缀放到 URL 里。 为了设计你自己的 URL,你需要创建一个叫做 URLconf 的 Python 模块。一张包含 URL 匹配模 式和 Python 回调函数之间的映射表。URLconf pub_date|date:”F j, Y” }} 使用了 Unix 风格的“管道符”(“|”字 符)。这是一个模板过滤器,用于过滤变量值。在这里过滤器将一个 Python datetime 对象转化 为指定的格式(就像 PHP 中的日期函数那样)。 你可以将多个过滤器连在一起使用。你还可以自定义模板过滤器。你甚至可以自定义模板标签,相关 的 Python 代码会在使用标签时在后台运行。 Django 使用了“模板继承”的概念。这就是 的内部保留字来命名你的项目。具体地说,你得避免使用像 django(会和 Django 自己冲 突) 或 test(会和 Python 的内置模块冲突) 这样的名字。 我的代码该放在哪? 如果你曾经是老式 PHP 程序员(没有使用过现代框架),你可能会习惯地把代码放在 Web 服务器的文档根目录(比如 /var/www)。但使用 Django 时你不用这样做。而且把所有 Python 代码放在 Web 服务器的根目录不是个好主意,因为这样会0 码力 | 103 页 | 1.86 MB | 1 年前3
Django、Vue 和Element UI 前后端原理论述www.51testing.com 后端开发(Django+Rest Framework+MySQL): Django 负责处理 HTTP 请求和响应,以及 URL 路由的配置。它接收来自前端的 HTTP 请求,并根据 URL 将请求分发给相应的视图函数进行处理。 Rest Framework 是 Django 的扩展,用于快速构建 RESTful API 接口。通过 Rest Framework,可以定义 前端通过 HTTP 请求向后端发送数据请求,后端根据请求进行相应的数据处理,并 返回响应数据给前端。 前端接收到后端返回的数据,并根据数据更新页面展示,实现与用户的交互。 总体而言,这种前后端分离的开发模式有助于实现前后端开发的解耦,使得各自的 开发工作更加专注和高效。前端负责用户界面的呈现和交互,后端负责数据处理和业务 逻辑,通过 API 接口进行数据传输和交互,从而实现一个完整的 Web 数据反序列化为数据对象,便于在后端进行 处理。 视图:DRF 提供了各种视图类,用于处理 API 请求,并返回适当的响应。包括基于 函数的视图和基于类的视图,还有通用视图和视图集等。 路由:DRF 提供了灵活的路由功能,用于将 API 请求映射到相应的视图处理函数上。 认证和权限:DRF 支持各种认证和权限控制方式,可以保护 API 的安全性。 分页和过滤:DRF 提供了分页和过滤功能,便于处理大量数据和筛选查询结果。0 码力 | 61 页 | 6.84 MB | 1 年前3
Django 1.8.x Documentationhigh-quality Web application. Django encourages beautiful URL design and doesn’t put any cruft in URLs, like .php or .asp. To design URLs for an app, you create a Python module called a URLconf. A table of contents variable. In this case, the date filter formats a Python datetime object in the given format (as found in PHP’s date function). You can chain together as many filters as you’d like. You can write custom template with a built-in Python package). Where should this code live? If your background is in plain old PHP (with no use of modern frameworks), you’re probably used to putting code under the Web server’s document0 码力 | 1685 页 | 6.01 MB | 1 年前3
Django 1.8.x Documentationhigh-quality Web application. Django encourages beautiful URL design and doesn’t put any cruft in URLs, like .php or .asp. To design URLs for an app, you create a Python module called a URLconf. A table of contents variable. In this case, the date filter formats a Python datetime object in the given format (as found in PHP’s date function). You can chain together as many filters as you’d like. You can write custom template with a built-in Python package). Where should this code live? If your background is in plain old PHP (with no use of modern frameworks), you’re probably used to putting code under the Web server’s document0 码力 | 2454 页 | 2.85 MB | 1 年前3
Django 1.10.x Documentationhigh-quality Web application. Django encourages beautiful URL design and doesn’t put any cruft in URLs, like .php or .asp. To design URLs for an app, you create a Python module called a URLconf. A table of contents variable. In this case, the date filter formats a Python datetime object in the given format (as found in PHP’s date function). You can chain together as many filters as you’d like. You can write custom template with a built-in Python package). Where should this code live? If your background is in plain old PHP (with no use of modern frameworks), you’re probably used to putting code under the Web server’s document0 码力 | 1817 页 | 6.19 MB | 1 年前3
Django 1.10.x Documentationhigh-quality Web application. Django encourages beautiful URL design and doesn’t put any cruft in URLs, like .php or .asp. To design URLs for an app, you create a Python module called a URLconf. A table of contents variable. In this case, the date filter formats a Python datetime object in the given format (as found in PHP’s date function). You can chain together as many filters as you’d like. You can write custom template with a built-in Python package). Where should this code live? If your background is in plain old PHP (with no use of modern frameworks), you’re probably used to putting code under the Web server’s document0 码力 | 2538 页 | 2.59 MB | 1 年前3
Django 5.0.x Documentationhigh-quality web application. Django encourages beautiful URL design and doesn’t put any cruft in URLs, like .php or .asp. To design URLs for an app, you create a Python module called a URLconf. A table of contents variable. In this case, the date filter formats a Python datetime object in the given format (as found in PHP’s date function). You can chain together as many filters as you’d like. You can write custom template with a built-in Python package). Where should this code live? If your background is in plain old PHP (with no use of modern frameworks), you’re probably used to putting code under the web server’s document0 码力 | 3407 页 | 3.21 MB | 1 年前3
Django 5.1 Documentationhigh-quality web application. Django encourages beautiful URL design and doesn’t put any cruft in URLs, like .php or .asp. To design URLs for an app, you create a Python module called a URLconf. A table of contents variable. In this case, the date filter formats a Python datetime object in the given format (as found in PHP’s date function). You can chain together as many filters as you’d like. You can write custom template and solely, cookie-based. It does not fall back to putting session IDs in URLs as a last resort, as PHP does. This is an intentional design decision. Not only does that behavior make URLs ugly, it makes0 码力 | 3513 页 | 3.17 MB | 1 年前3
Django 5.1.2 Documentationhigh-quality web application. Django encourages beautiful URL design and doesn’t put any cruft in URLs, like .php or .asp. To design URLs for an app, you create a Python module called a URLconf. A table of contents variable. In this case, the date filter formats a Python datetime object in the given format (as found in PHP’s date function). You can chain together as many filters as you’d like. You can write custom template and solely, cookie-based. It does not fall back to putting session IDs in URLs as a last resort, as PHP does. This is an intentional design decision. Not only does that behavior make URLs ugly, it makes0 码力 | 3519 页 | 3.17 MB | 1 年前3
Django 1.11.x Documentationhigh-quality Web application. Django encourages beautiful URL design and doesn’t put any cruft in URLs, like .php or .asp. To design URLs for an app, you create a Python module called a URLconf. A table of contents variable. In this case, the date filter formats a Python datetime object in the given format (as found in PHP’s date function). You can chain together as many filters as you’d like. You can write custom template with a built-in Python package). Where should this code live? If your background is in plain old PHP (with no use of modern frameworks), you’re probably used to putting code under the Web server’s document0 码力 | 1878 页 | 6.40 MB | 1 年前3
共 32 条
- 1
- 2
- 3
- 4













