 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 官方教程翻译项目你的团队(或者客户)就可以向网站里填充数据了。后面我们会谈到如何展示这些数据。 简洁优雅的 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 前后端原理论述51testing.com 这是一篇什么文章? 一篇你对测试开发工作感兴趣,想了解系统工作逻辑的文章。 一篇是你在开始动手搭建环境前需要了解各工具原理的文章。 这是一篇你真正开始前需要查阅的文章。 本文介绍了前后端工作原理,前后端搭建的流程、搭建过程中需要用到的技术以及 开发环境版本。 一、前后端如何工作 Django、Vue 和 Element UI 前后 端原理论述  作者:M&T. 接口进行数据传输和交互,从而实现一个完整的 Web 应用。 3 《51 测试天地》七十四 www.51testing.com 二、搭建流程 2.1 后端搭建流程 安装相关包->创建工程->后端依赖(pipenv)创建虚拟环境->后端服务配置启动->后 端创建子应用->后端 Rest Framework->数据库配置 简要说明: 安装相关包:在开始之前,首先需要安装 Python 和 pip,然后安装 Django 的命令行工具创建 Django 项目,例如:django-admin startproject projectname。 后端依赖(pipenv)创建虚拟环境:建议使用 pipenv 来创建和管理虚拟环境,以便 隔离项目的依赖和环境。 后端服务配置启动:在虚拟环境下,通过 Django 的 manage.py 启动服务,例如:python manage.py runserver。 后端创建子应用:根据0 码力 | 61 页 | 6.84 MB | 1 年前3 Django、Vue 和Element UI 前后端原理论述51testing.com 这是一篇什么文章? 一篇你对测试开发工作感兴趣,想了解系统工作逻辑的文章。 一篇是你在开始动手搭建环境前需要了解各工具原理的文章。 这是一篇你真正开始前需要查阅的文章。 本文介绍了前后端工作原理,前后端搭建的流程、搭建过程中需要用到的技术以及 开发环境版本。 一、前后端如何工作 Django、Vue 和 Element UI 前后 端原理论述  作者:M&T. 接口进行数据传输和交互,从而实现一个完整的 Web 应用。 3 《51 测试天地》七十四 www.51testing.com 二、搭建流程 2.1 后端搭建流程 安装相关包->创建工程->后端依赖(pipenv)创建虚拟环境->后端服务配置启动->后 端创建子应用->后端 Rest Framework->数据库配置 简要说明: 安装相关包:在开始之前,首先需要安装 Python 和 pip,然后安装 Django 的命令行工具创建 Django 项目,例如:django-admin startproject projectname。 后端依赖(pipenv)创建虚拟环境:建议使用 pipenv 来创建和管理虚拟环境,以便 隔离项目的依赖和环境。 后端服务配置启动:在虚拟环境下,通过 Django 的 manage.py 启动服务,例如:python manage.py runserver。 后端创建子应用:根据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 码力 | 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.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 码力 | 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 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.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 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 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 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














