{"title":"How to release Django","version":"5.2","locale":"zh-hans","docname":"internals/howto-release-django","url":"/zh-hans/5.2/internals/howto-release-django/","canonical":"https://djangodocs.dev/zh-hans/5.2/internals/howto-release-django/","summary":"这份文档解释了如何发布 Django。 请在进行更改时保持这些说明的最新状态！ 这里的重点是描述性的，而不是规范性的，所以请随意简化或进行其他更改，但 相应地更新这份文档！ 概况 Link to this heading # 有三种类型的发布可能需要进行： 安全性发布：揭示和修复漏洞。这通常涉及到两个或三个同时发布的版本，例如…","html":"<h1>How to release Django<a class=\"heading-anchor\" href=\"#how-to-release-django\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>这份文档解释了如何发布 Django。</p>\n<p><strong>请在进行更改时保持这些说明的最新状态！</strong> 这里的重点是描述性的，而不是规范性的，所以请随意简化或进行其他更改，但 <strong>相应地更新这份文档！</strong></p>\n<section id=\"overview\">\n<h2>概况<a class=\"heading-anchor\" href=\"#overview\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>有三种类型的发布可能需要进行：</p>\n<ul class=\"simple\">\n<li><p>安全性发布：揭示和修复漏洞。这通常涉及到两个或三个同时发布的版本，例如 3.2.x、4.0.x，根据时间的安排，可能还包括 4.1.x。</p></li>\n<li><p>常规版本发布：可以是最终发布（例如 4.1）或错误修复更新（例如 4.1.1）。</p></li>\n<li><p>预发布版本：例如 4.2 alpha、beta 或 rc。</p></li>\n</ul>\n<p>涉及的步骤的简短版本是：</p>\n<ol class=\"arabic simple\">\n<li><p>如果这是一个安全性发布，请在实际发布前一周预先通知安全性发布列表。</p></li>\n<li><p>校对发布说明，查找组织和写作错误。起草一篇博客文章和电子邮件公告。</p></li>\n<li><p>Update version numbers and create the release artifacts.</p></li>\n<li><p>Create the new <code class=\"docutils literal notranslate\"><span class=\"pre\">Release</span></code> in the admin on <code class=\"docutils literal notranslate\"><span class=\"pre\">djangoproject.com</span></code>.</p>\n<ol class=\"arabic simple\">\n<li><p>Set the proper date but ensure the flag <code class=\"docutils literal notranslate\"><span class=\"pre\">is_active</span></code> is disabled.</p></li>\n<li><p>Upload the artifacts (tarball, wheel, and checksums).</p></li>\n</ol>\n</li>\n<li><p>验证包的签名，检查它们是否可以安装，并确保最小功能可用。</p></li>\n<li><p>将新版本上传到 PyPI。</p></li>\n<li><p>Enable the <code class=\"docutils literal notranslate\"><span class=\"pre\">is_active</span></code> flag for each release in the admin on\n<code class=\"docutils literal notranslate\"><span class=\"pre\">djangoproject.com</span></code>.</p></li>\n<li><p>发布博客文章并发送电子邮件公告。</p></li>\n<li><p>Update version numbers post-release in stable branch(es).</p></li>\n<li><p>Add stub release notes for the next patch release in <code class=\"docutils literal notranslate\"><span class=\"pre\">main</span></code> and backport.</p></li>\n</ol>\n<p>有很多细节，请继续阅读。</p>\n</section>\n<section id=\"prerequisites\">\n<h2>先决条件<a class=\"heading-anchor\" href=\"#prerequisites\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>在开始之前，你需要准备一些东西。如果这是你第一次发布，你需要与另一位发布者协调，确保所有事项都准备妥当，并写信给 Ops 邮件列表，请求所需的访问权限和许可。</p>\n<ul>\n<li><p>一个安装了以下工具的 Unix 环境（按字母顺序排列）：</p>\n<ul class=\"simple\">\n<li><p>bash</p></li>\n<li><p>git</p></li>\n<li><p>GPG</p></li>\n<li><p>make</p></li>\n<li><p>man</p></li>\n<li><p>哈希工具（通常在 Linux 上是 <code class=\"docutils literal notranslate\"><span class=\"pre\">md5sum</span></code>、<code class=\"docutils literal notranslate\"><span class=\"pre\">sha1sum</span></code> 和 <code class=\"docutils literal notranslate\"><span class=\"pre\">sha256sum</span></code>，在 macOS 上是 <code class=\"docutils literal notranslate\"><span class=\"pre\">md5</span></code> 和 <code class=\"docutils literal notranslate\"><span class=\"pre\">shasum</span></code>）</p></li>\n<li><p>python</p></li>\n</ul>\n</li>\n<li><p>一个 GPG 密钥对。确保此密钥的私钥部分安全存储。公钥部分需要上传到你的 GitHub 账户，以及运行“确认发布”作业的 Jenkins 服务器。</p>\n<aside class=\"admonition-more-than-one-gpg-key admonition\">\n<p class=\"admonition-title\">多个 GPG 密钥</p>\n<p>如果你想使用的密钥不是你的默认签名密钥，你需要在下面显示的每个 GPG 签名命令中添加 <code class=\"docutils literal notranslate\"><span class=\"pre\">-u</span> <span class=\"pre\">you&#64;example.com</span></code>，其中 <code class=\"docutils literal notranslate\"><span class=\"pre\">you&#64;example.com</span></code> 是与你想要使用的密钥关联的电子邮件地址。</p>\n</aside>\n</li>\n<li><p>A clean Python virtual environment (Python 3.9+) to build artifacts, with\nthese required Python packages installed:</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span>python<span class=\"w\"> </span>-m<span class=\"w\"> </span>pip<span class=\"w\"> </span>install<span class=\"w\"> </span>build<span class=\"w\"> </span>twine\n</code></pre></div>\n</li>\n<li><p>访问 <a class=\"reference external\" href=\"https://pypi.org/project/Django/\">Django 在 PyPI 上的项目</a> 以上传二进制文件，最好具有在必要时 <a class=\"reference external\" href=\"https://pypi.org/help/#yanked\">撤回发布</a> 的额外权限。按照 <a class=\"reference external\" href=\"https://pypi.org/help/#apitoken\">官方文档</a> 创建一个项目范围的令牌，并按如下方式设置你的 <code class=\"docutils literal notranslate\"><span class=\"pre\">$HOME/.pypirc</span></code> 文件：</p>\n<figure class=\"code-block code-block-captioned\" data-language=\"ini\"><figcaption class=\"code-block-caption\"><code class=\"docutils literal notranslate\"><span class=\"pre\">~/.pypirc</span></code></figcaption>\n<div class=\"code-block-toolbar\"><span class=\"code-block-language\">Ini</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Ini code\"><code><span class=\"k\">[distutils]</span>\n<span class=\"w\">  </span><span class=\"na\">index-servers</span><span class=\"w\"> </span><span class=\"o\">=</span>\n<span class=\"w\">    </span><span class=\"na\">pypi</span>\n<span class=\"w\">    </span><span class=\"na\">django</span>\n\n<span class=\"k\">[pypi]</span>\n<span class=\"w\">  </span><span class=\"na\">username</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"s\">__token__</span>\n<span class=\"w\">  </span><span class=\"na\">password</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"c1\"># User-scoped or project-scoped token, to set as the default.</span>\n\n<span class=\"k\">[django]</span>\n<span class=\"w\">  </span><span class=\"na\">repository</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"s\">https://upload.pypi.org/legacy/</span>\n<span class=\"w\">  </span><span class=\"na\">username</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"s\">__token__</span>\n<span class=\"w\">  </span><span class=\"na\">password</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"c1\"># A project token.</span>\n</code></pre></figure>\n</li>\n<li><p>访问 <a class=\"reference external\" href=\"https://app.transifex.com/django/django/\">Django 在 Transifex 上的项目</a>，并具有管理员角色。在 <a class=\"reference external\" href=\"https://app.transifex.com/user/settings/api/\">用户设置部分</a> 生成一个 API 令牌，并按如下方式设置你的 <code class=\"docutils literal notranslate\"><span class=\"pre\">$HOME/.transifexrc</span></code> 文件：</p>\n<figure class=\"code-block code-block-captioned\" data-language=\"ini\"><figcaption class=\"code-block-caption\"><code class=\"docutils literal notranslate\"><span class=\"pre\">~/.transifexrc</span></code></figcaption>\n<div class=\"code-block-toolbar\"><span class=\"code-block-language\">Ini</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Ini code\"><code><span class=\"k\">[https://www.transifex.com]</span>\n<span class=\"w\">  </span><span class=\"na\">rest_hostname</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"s\">https://rest.api.transifex.com</span>\n<span class=\"w\">  </span><span class=\"na\">token</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"c1\"># API token</span>\n</code></pre></figure>\n</li>\n<li><p>作为“站点维护者”访问 <code class=\"docutils literal notranslate\"><span class=\"pre\">djangoproject.com</span></code> 上的 Django 管理界面。</p></li>\n<li><p>Access to create a post in the <a class=\"reference external\" href=\"https://forum.djangoproject.com/c/announcements/7\">Django Forum - Announcements category</a> and to send emails to\nthe <a class=\"reference external\" href=\"https://groups.google.com/g/django-announce/\">django-announce</a>\nmailing list.</p></li>\n<li><p>访问 GitHub 中的 <code class=\"docutils literal notranslate\"><span class=\"pre\">django-security</span></code> 仓库。除其他事项外，这提供了对预通知分发列表的访问权限（安全发布准备任务所需）。</p></li>\n<li><p>Access to the Django project on <a class=\"reference external\" href=\"https://readthedocs.org/projects/django/\">Read the Docs</a>.</p></li>\n</ul>\n</section>\n<section id=\"pre-release-tasks\">\n<h2>发布前的任务<a class=\"heading-anchor\" href=\"#pre-release-tasks\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>在开始发布过程之前，需要处理一些事项。这些工作大约在发布前一周开始；大部分工作可以在实际发布前的任何时间完成。</p>\n<section id=\"or-more-days-before-a-security-release\">\n<h3>安全发布前 10 天（或更早）<a class=\"heading-anchor\" href=\"#or-more-days-before-a-security-release\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ol class=\"arabic simple\">\n<li><p>为即将发布的安全问题请求 <a class=\"reference external\" href=\"https://cveform.mitre.org/\">CVE ID</a>。每个问题一个 CVE ID，请求时使用 <code class=\"docutils literal notranslate\"><span class=\"pre\">Vendor:</span> <span class=\"pre\">djangoproject</span></code> 和 <code class=\"docutils literal notranslate\"><span class=\"pre\">Product:</span> <span class=\"pre\">django</span></code>。</p></li>\n<li><p>使用 <code class=\"docutils literal notranslate\"><span class=\"pre\">git</span> <span class=\"pre\">format-patch</span></code> 生成相关的（私有）补丁，一个用于 <code class=\"docutils literal notranslate\"><span class=\"pre\">main</span></code> 分支，一个用于每个正在修补的稳定分支。</p></li>\n</ol>\n</section>\n<section id=\"a-week-before-a-security-release\">\n<h3>安全发布前一周<a class=\"heading-anchor\" href=\"#a-week-before-a-security-release\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ol class=\"arabic\">\n<li><p>在安全发布前 <strong>一周</strong> 发送预通知。该电子邮件的模板和收件人列表在私有的 <code class=\"docutils literal notranslate\"><span class=\"pre\">django-security</span></code> GitHub wiki 中。将预通知收件人放在密件抄送中，并确保包含相关的 CVE ID。附上所有相关的补丁（针对 <code class=\"docutils literal notranslate\"><span class=\"pre\">main</span></code> 和稳定分支），并使用你将用于发布的密钥对电子邮件文本进行签名，命令如下：</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span>gpg<span class=\"w\"> </span>--clearsign<span class=\"w\"> </span>--digest-algo<span class=\"w\"> </span>SHA256<span class=\"w\"> </span>prenotification-email.txt\n</code></pre></div>\n</li>\n<li><p><a class=\"reference internal\" href=\"/zh-hans/5.2/internals/security/#security-disclosure\"><span class=\"std std-ref\">通知 django-announce</span></a> 即将发布的安全版本，使用如下一般消息：</p>\n<div class=\"code-block\" data-language=\"text\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Text</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Text code\"><code>Notice of upcoming Django security releases (3.2.24, 4.2.10 and 5.0.2)\n\nDjango versions 5.0.2, 4.2.10, and 3.2.24 will be released on Tuesday,\nFebruary 6th, 2024 around 1500 UTC. They will fix one security defect\nwith severity &quot;moderate&quot;.\n\nFor details of severity levels, see:\nhttps://docs.djangoproject.com/en/dev/internals/security/#how-django-discloses-security-issues\n</code></pre></div>\n</li>\n</ol>\n</section>\n<section id=\"a-few-days-before-any-release\">\n<h3>任何发布前几天<a class=\"heading-anchor\" href=\"#a-few-days-before-any-release\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<ol class=\"arabic\">\n<li><p>As the release approaches, watch Trac to make sure no release blockers are\nleft for the upcoming release. Under exceptional circumstances, such as to\nmeet a pre-determined security release date, a release could still go ahead\nwith an open release blocker. The releaser is trusted with the decision to\nrelease with an open release blocker or to postpone the release date of a\nnon-security release if required.</p></li>\n<li><p>与其他合并人员核对，确保他们没有为发布而提交的未提交更改。</p></li>\n<li><p>校对发布说明，包括查看在线版本以 <a class=\"reference internal\" href=\"/zh-hans/5.2/internals/contributing/writing-documentation/#documentation-link-check\"><span class=\"std std-ref\">捕捉任何损坏的链接</span></a> 或 reST 错误，并确保发布说明包含正确的日期。</p></li>\n<li><p>再次确认发布说明中提到了任何已经标记为弃用的 API 的弃用时间表，并且提到了对 Python 版本支持的任何更改。</p></li>\n<li><p>再次检查发布说明索引中是否有指向新发布版本说明的链接；这将在 <code class=\"docutils literal notranslate\"><span class=\"pre\">docs/releases/index.txt</span></code> 中。</p></li>\n<li><p>如果这是一个 <span class=\"xref std std-term\">功能发布</span>，确保已集成来自 Transifex 的翻译。这通常由单独的翻译管理者而不是发布者完成，但以下是步骤。这个过程有点长，所以一定要预留 4-10 小时来完成，最好在发布日前一两天安排此任务。</p>\n<p>除了配置好的 Transifex 账户外，<a class=\"reference external\" href=\"https://developers.transifex.com/docs/cli\">tx CLI</a> 应该在 <code class=\"docutils literal notranslate\"><span class=\"pre\">PATH</span></code> 中可用。然后，你可以通过运行以下命令获取所有翻译：</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span>python<span class=\"w\"> </span>scripts/manage_translations.py<span class=\"w\"> </span>fetch\n</code></pre></div>\n<p>此命令需要一些时间运行。完成后，仔细检查输出以查找潜在的错误和/或警告。如果有，你需要逐个调试并解决它们。</p>\n<p>最近获取的翻译需要一些手动调整。首先，<code class=\"docutils literal notranslate\"><span class=\"pre\">PO-Revision-Date</span></code> 值必须手动更新为晚于 <code class=\"docutils literal notranslate\"><span class=\"pre\">POT-Creation-Date</span></code>。你可以使用类似于以下的命令批量更新所有 <code class=\"docutils literal notranslate\"><span class=\"pre\">.po</span></code> 文件（与相关稳定分支进行比较）：</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span>git<span class=\"w\"> </span>diff<span class=\"w\"> </span>--name-only<span class=\"w\"> </span>stable/5.0.x<span class=\"w\"> </span><span class=\"p\">|</span><span class=\"w\"> </span>grep<span class=\"w\"> </span><span class=\"s2\">&quot;\\.po&quot;</span><span class=\"w\">  </span><span class=\"p\">|</span><span class=\"w\"> </span>xargs<span class=\"w\"> </span>sed<span class=\"w\"> </span>-ri<span class=\"w\"> </span><span class=\"s2\">&quot;s/PO-Revision-Date: [0-9\\-]+ /PO-Revision-Date: </span><span class=\"k\">$(</span>date<span class=\"w\"> </span>-I<span class=\"k\">)</span><span class=\"s2\"> /g&quot;</span>\n</code></pre></div>\n<p>所有新的 <code class=\"docutils literal notranslate\"><span class=\"pre\">.po</span></code> 文件都应手动仔细检查，以避免提交没有任何新翻译的文件的更改。此外，“复数形式”不应有任何更改：如果有（通常是西班牙语和法语报告此更改），则需要还原。</p>\n<p>最后，提交更改/添加的文件（<code class=\"docutils literal notranslate\"><span class=\"pre\">.po</span></code> 和 <code class=\"docutils literal notranslate\"><span class=\"pre\">.mo</span></code>），并创建一个针对相应发布稳定分支的新 PR（例如 <a class=\"reference external\" href=\"https://github.com/django/django/pull/16715\">更新 4.2 翻译的 PR</a>）。</p>\n</li>\n<li><p><a class=\"reference internal\" href=\"/zh-hans/5.2/internals/contributing/writing-documentation/#django-admin-manpage\"><span class=\"std std-ref\">更新 django-admin 手册页面</span></a>：</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span><span class=\"nb\">cd</span><span class=\"w\"> </span>docs\n$<span class=\"w\"> </span>make<span class=\"w\"> </span>man\n$<span class=\"w\"> </span>man<span class=\"w\"> </span>_build/man/django-admin.1<span class=\"w\">  </span><span class=\"c1\"># do a quick sanity check</span>\n$<span class=\"w\"> </span>cp<span class=\"w\"> </span>_build/man/django-admin.1<span class=\"w\"> </span>man/django-admin.1\n</code></pre></div>\n<p>然后提交已更改的手册页面。</p>\n</li>\n<li><p>如果这是一个新系列的 &quot;点零&quot; 发布，请从当前稳定分支在 <a class=\"reference external\" href=\"https://github.com/django/django-docs-translations\">django-docs-translations</a> 存储库中创建一个新分支。例如，发布 Django 4.2 时：</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span>git<span class=\"w\"> </span>checkout<span class=\"w\"> </span>-b<span class=\"w\"> </span>stable/4.2.x<span class=\"w\"> </span>origin/stable/4.1.x\n$<span class=\"w\"> </span>git<span class=\"w\"> </span>push<span class=\"w\"> </span>origin<span class=\"w\"> </span>stable/4.2.x:stable/4.2.x\n</code></pre></div>\n</li>\n<li><p>为发布撰写公告博客文章。你可以随时输入它到管理员界面并将其标记为非活动状态。以下是一些示例：<a class=\"reference external\" href=\"https://www.djangoproject.com/weblog/2013/feb/19/security/\">示例安全发布公告</a>、<a class=\"reference external\" href=\"https://www.djangoproject.com/weblog/2012/mar/23/14/\">示例常规发布公告</a>、<a class=\"reference external\" href=\"https://www.djangoproject.com/weblog/2012/nov/27/15-beta-1/\">示例预发布公告</a>。</p></li>\n</ol>\n<section id=\"a-few-days-before-a-feature-freeze\">\n<h4>A few days before a feature freeze<a class=\"heading-anchor\" href=\"#a-few-days-before-a-feature-freeze\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>In preparation for the alpha release, the directory\n<code class=\"docutils literal notranslate\"><span class=\"pre\">/home/www/www/media/releases/A.B</span></code> must be created on the djangoproject\nserver.</p>\n<p>Before the feature freeze, a branch targeting <code class=\"docutils literal notranslate\"><span class=\"pre\">main</span></code> must be created to\nprepare for the next feature release. It should be reviewed and approved a few\ndays before the freeze, allowing it to be merged after the stable branch is\ncut. The following items should be addressed in this branch:</p>\n<ol class=\"arabic simple\">\n<li><p>Update the <code class=\"docutils literal notranslate\"><span class=\"pre\">VERSION</span></code> tuple in <code class=\"docutils literal notranslate\"><span class=\"pre\">django/__init__.py</span></code>, incrementing to the\nnext expected release (<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/96700c7b378c592f0b1732302c22af2fd2c87fc6\">example commit</a>).</p></li>\n<li><p>Create a stub release note for the next feature release. Use the stub from\nthe previous feature release or copy the contents from the current version\nand delete most of the contents leaving only the headings\n(<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/9b5ad4056ccf9ff7ea548f72d28eb66c1b4f84cc\">example commit</a>).</p></li>\n<li><p>Remove <code class=\"docutils literal notranslate\"><span class=\"pre\">..</span> <span class=\"pre\">versionadded::</span></code> and <code class=\"docutils literal notranslate\"><span class=\"pre\">..</span> <span class=\"pre\">versionchanged::</span></code> annotations in the\ndocumentation from two releases ago, as well as any remaining older\nannotations. For example, in Django 5.1, notes for 4.2 will be removed\n(<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/9edb7833b89e811eefd94974fb987f4605b0c0d7\">example commit</a>).</p></li>\n<li><p>Remove features that have reached the end of their deprecation cycle,\nincluding their docs and the <code class=\"docutils literal notranslate\"><span class=\"pre\">..</span> <span class=\"pre\">deprecated::</span></code> annotation. Each removal\nshould be done in a separate commit for clarity. In the commit message, add\na <code class=\"docutils literal notranslate\"><span class=\"pre\">Refs</span> <span class=\"pre\">#XXXXX</span> <span class=\"pre\">--</span></code> prefix linking to the original ticket where the\ndeprecation began if possible. Make sure this gets noted in the removed\nfeatures section in the release notes (<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/f2d9c76aa7096ef3eed675b9eb824858f9dd81e5\">example commit</a>).</p></li>\n<li><p>Increase the default PBKDF2 iterations in\n<code class=\"docutils literal notranslate\"><span class=\"pre\">django.contrib.auth.hashers.PBKDF2PasswordHasher</span></code> by about 20%\n(pick a round number). Run the tests, and update the 3 failing\nhasher tests with the new values. Make sure this gets noted in the\nrelease notes (<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/7288866da4dddf3705148c703421858ec19cdb78\">example commit</a>).</p></li>\n</ol>\n<p>Concrete examples for past feature release bootstrap branches: <a class=\"reference external\" href=\"https://github.com/django/django/pull/18127\">5.2 bootstrap</a>, <a class=\"reference external\" href=\"https://github.com/django/django/pull/17246\">5.1 bootstrap</a>, <a class=\"reference external\" href=\"https://github.com/django/django/pull/16432\">5.0 bootstrap</a>.</p>\n</section>\n</section>\n</section>\n<section id=\"feature-freeze-tasks\">\n<h2>Feature freeze tasks<a class=\"heading-anchor\" href=\"#feature-freeze-tasks\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<ol class=\"arabic\">\n<li><p>Remove empty sections from the release notes (<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/9e6e58bad237a80ddd5e3ab8b834cecdaad8455e\">example commit</a>).</p></li>\n<li><p>Build the release notes locally and read them. Make any necessary change\nto improve flow or fix grammar (<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/435bdab93889dae01e71c79598edab10627cc1f9\">example commit</a>).</p></li>\n<li><p>Create a new stable branch from <code class=\"docutils literal notranslate\"><span class=\"pre\">main</span></code>. For example, when feature freezing\nDjango 5.2:</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span>git<span class=\"w\"> </span>checkout<span class=\"w\"> </span>-b<span class=\"w\"> </span>stable/5.2.x<span class=\"w\"> </span>upstream/main\n$<span class=\"w\"> </span>git<span class=\"w\"> </span>push<span class=\"w\"> </span>upstream<span class=\"w\"> </span>-u<span class=\"w\"> </span>stable/5.2.x:stable/5.2.x\n</code></pre></div>\n<p>At the same time, update the <code class=\"docutils literal notranslate\"><span class=\"pre\">django_next_version</span></code> variable in\n<code class=\"docutils literal notranslate\"><span class=\"pre\">docs/conf.py</span></code> on the stable release branch to point to the new\ndevelopment version. For example, when creating <code class=\"docutils literal notranslate\"><span class=\"pre\">stable/5.2.x</span></code>, set\n<code class=\"docutils literal notranslate\"><span class=\"pre\">django_next_version</span></code> to <code class=\"docutils literal notranslate\"><span class=\"pre\">'6.0'</span></code> on the new stable branch\n(<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/1eb62e5b622ef7fd6e0123d8bbf6662d893d5d08\">example commit</a>).</p>\n</li>\n<li><p>Go to the <a class=\"reference external\" href=\"https://www.djangoproject.com/admin/releases/release/add/\">Add release page in the admin</a>, create a <code class=\"docutils literal notranslate\"><span class=\"pre\">Release</span></code> object for\nthe <em>final</em> release, ensuring that the <em>Release date</em> field is blank, thus\nmarking it as <em>unreleased</em>. For example, when creating <code class=\"docutils literal notranslate\"><span class=\"pre\">stable/5.2.x</span></code>,\ncreate <code class=\"docutils literal notranslate\"><span class=\"pre\">5.2</span></code> with the Release date field blank. If the release is part of\nan LTS branch, mark it so.</p>\n</li>\n<li><p>Go to the <a class=\"reference external\" href=\"https://www.djangoproject.com/admin/docs/documentrelease/add/\">Add document release page in the admin</a>, create a new\n<code class=\"docutils literal notranslate\"><span class=\"pre\">DocumentRelease</span></code> object for the English language for the newly created\n<code class=\"docutils literal notranslate\"><span class=\"pre\">Release</span></code> object. Do not mark this as default.</p>\n</li>\n<li><p>将新分支添加到 <a class=\"reference external\" href=\"https://readthedocs.org/projects/django/\">Read the Docs</a>。由于自动生成的版本名称（&quot;stable-A.B.x&quot;）与 Read the Docs 中使用的版本名称（&quot;A.B.x&quot;）不同，因此请创建一个 <a class=\"reference external\" href=\"https://github.com/readthedocs/readthedocs.org/issues/5537\">票务请求</a> 请求新版本。</p></li>\n<li><p><a class=\"reference external\" href=\"https://github.com/pypa/trove-classifiers/issues/29\">Request the new classifier on PyPI</a>. For example\n<code class=\"docutils literal notranslate\"><span class=\"pre\">Framework</span> <span class=\"pre\">::</span> <span class=\"pre\">Django</span> <span class=\"pre\">::</span> <span class=\"pre\">5.2</span></code>.</p></li>\n<li><p>Create a <a class=\"reference external\" href=\"https://code.djangoproject.com/wiki/Version6.0Roadmap\">roadmap page</a> for the next\nrelease on Trac. To create a new page on the Wiki, navigate to the URL of\nwhere you wish to create the page and a &quot;Create this page&quot; button will be\navailable.</p></li>\n<li><p>更新当前处于活跃开发中的分支，并在 Trac 上的 <a class=\"reference external\" href=\"https://code.djangoproject.com/#Djangoreleaseprocess\">Django 发布流程</a> 中添加预发布分支。</p></li>\n<li><p>Update the <code class=\"docutils literal notranslate\"><span class=\"pre\">docs/fixtures/doc_releases.json</span></code> JSON fixture for\ndjangoproject.com, so people without access to the production DB can still\nrun an up-to-date copy of the docs site\n(<a class=\"reference external\" href=\"https://github.com/django/djangoproject.com/pull/1446\">example PR</a>).\nThis will be merged after the final release.</p></li>\n</ol>\n</section>\n<section id=\"actually-rolling-the-release\">\n<h2>实际发布版本<a class=\"heading-anchor\" href=\"#actually-rolling-the-release\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>好的，这是有趣的部分，我们实际上要发布一个版本！如果你要发布 <strong>多个版本</strong>，请为每个版本重复这些步骤。</p>\n<ol class=\"arabic\">\n<li><p>检查 <a class=\"reference external\" href=\"https://djangoci.com\">Jenkins</a> 是否为你要发布的版本显示绿色。在它变绿之前，你可能不应该发布版本，并且你应该确保最新的绿色运行包括你要发布的更改。</p>\n</li>\n<li><p>清理此版本的发布说明。在 <code class=\"docutils literal notranslate\"><span class=\"pre\">main</span></code> 中进行这些更改，并向后移植到特定版本发布说明所在的所有分支。</p>\n<ol class=\"arabic simple\">\n<li><p>对于功能发布，删除发布说明顶部的 <code class=\"docutils literal notranslate\"><span class=\"pre\">UNDER</span> <span class=\"pre\">DEVELOPMENT</span></code> 标题，删除 <code class=\"docutils literal notranslate\"><span class=\"pre\">Expected</span></code> 前缀，并在必要时更新发布日期（<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/1994a2643881a9e3f9fa8d3e0794c1a9933a1831\">示例提交</a>）。</p></li>\n<li><p>对于补丁发布，删除所有版本的 <code class=\"docutils literal notranslate\"><span class=\"pre\">Expected</span></code> 前缀，并在必要时更新发布日期（<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/34a503162fe222033a1cd3249bccad014fcd1d20\">示例提交</a>）。</p></li>\n</ol>\n</li>\n<li><p>发布总是从发布分支开始，因此你应该确保你在最新的稳定分支上。此外，你应该为每个发布的版本准备一个干净且专用的虚拟环境。例如：</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span>git<span class=\"w\"> </span>checkout<span class=\"w\"> </span>stable/4.1.x\n$<span class=\"w\"> </span>git<span class=\"w\"> </span>pull\n</code></pre></div>\n</li>\n<li><p>如果这是一个安全发布，请从 <code class=\"docutils literal notranslate\"><span class=\"pre\">django-security</span></code> 合并适当的补丁。根据需要重新基于这些补丁，使每个补丁都成为发布分支上的普通提交，而不是合并提交。为了确保这一点，使用 <code class=\"docutils literal notranslate\"><span class=\"pre\">--ff-only</span></code> 标志合并它们，例如：</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span>git<span class=\"w\"> </span>checkout<span class=\"w\"> </span>stable/4.1.x\n$<span class=\"w\"> </span>git<span class=\"w\"> </span>merge<span class=\"w\"> </span>--ff-only<span class=\"w\"> </span>security/4.1.x\n</code></pre></div>\n<p>（这假设 <code class=\"docutils literal notranslate\"><span class=\"pre\">security/4.1.x</span></code> 是 <code class=\"docutils literal notranslate\"><span class=\"pre\">django-security</span></code> 存储库中包含下一个 4.1 系列发布所需的安全补丁的分支。）</p>\n<p>如果 git 拒绝使用 <code class=\"docutils literal notranslate\"><span class=\"pre\">--ff-only</span></code> 合并，请切换到 security-patch 分支，并在你将要合并的分支上重新基于它（<code class=\"docutils literal notranslate\"><span class=\"pre\">git</span> <span class=\"pre\">checkout</span> <span class=\"pre\">security/4.1.x;</span> <span class=\"pre\">git</span> <span class=\"pre\">rebase</span> <span class=\"pre\">stable/4.1.x</span></code>），然后切换回来并执行合并操作。确保每个安全修复的提交消息解释了这个提交是一个安全修复，并且会有一个公告随后发布（<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/bf39978a53f117ca02e9a0c78b76664a41a54745\">示例安全提交</a>）。</p>\n</li>\n<li><p>在 <code class=\"docutils literal notranslate\"><span class=\"pre\">django/__init__.py</span></code> 中更新发布版本的版本号。有关 <code class=\"docutils literal notranslate\"><span class=\"pre\">VERSION</span></code> 的详细信息，请参阅下面的 设置 VERSION 元组的注意事项`_（:commit:`示例提交 &lt;2719a7f8c161233f45d34b624a9df9392c86cc1b&gt;）。</p>\n<ol class=\"arabic simple\">\n<li><p>If this is a pre-release package also update the &quot;Development Status&quot;\ntrove classifier in <code class=\"docutils literal notranslate\"><span class=\"pre\">pyproject.toml</span></code> to reflect this. An <code class=\"docutils literal notranslate\"><span class=\"pre\">rc</span></code>\npre-release should not change the trove classifier (<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/759921c8e9ad151932fc913ab429fef0a6112ef8\">example\ncommit for alpha release</a>,\n<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/25fec8940b24107e21314ab6616e18ce8dec1c1c\">example commit for beta release</a>).</p></li>\n<li><p>否则，确保分类器设置为 <code class=\"docutils literal notranslate\"><span class=\"pre\">Development</span> <span class=\"pre\">Status</span> <span class=\"pre\">::</span> <span class=\"pre\">5</span> <span class=\"pre\">-</span> <span class=\"pre\">Production/Stable</span></code>。</p></li>\n</ol>\n</li>\n</ol>\n<section id=\"building-the-artifacts\">\n<h3>Building the artifacts<a class=\"heading-anchor\" href=\"#building-the-artifacts\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<aside class=\"admonition-optionally-use-helper-scripts admonition\">\n<p class=\"admonition-title\">Optionally use helper scripts</p>\n<p>You can streamline some of the steps below using helper scripts from the\n<code class=\"docutils literal notranslate\"><span class=\"pre\">scripts</span></code> folder:</p>\n<ul class=\"simple\">\n<li><p>Release script example run:</p></li>\n</ul>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span><span class=\"nv\">PGP_KEY_ID</span><span class=\"o\">=</span>&lt;key-id&gt;<span class=\"w\"> </span><span class=\"nv\">PGP_KEY_URL</span><span class=\"o\">=</span>&lt;key-url&gt;<span class=\"w\"> </span><span class=\"nv\">DEST_FOLDER</span><span class=\"o\">=</span>~/releases<span class=\"w\"> </span>scripts/do_django_release.py\n</code></pre></div>\n<ul class=\"simple\">\n<li><p>Verify the release (after artifacts were uploaded):</p></li>\n</ul>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span><span class=\"nv\">VERSION</span><span class=\"o\">=</span><span class=\"m\">5</span>.2.1<span class=\"w\"> </span>scripts/verify_release.sh\n</code></pre></div>\n</aside>\n<ol class=\"arabic\">\n<li><p>使用 <code class=\"docutils literal notranslate\"><span class=\"pre\">git</span> <span class=\"pre\">tag</span></code> 标记发布。例如：</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span>git<span class=\"w\"> </span>tag<span class=\"w\"> </span>--sign<span class=\"w\"> </span>--message<span class=\"o\">=</span><span class=\"s2\">&quot;Tag 4.1.1&quot;</span><span class=\"w\"> </span><span class=\"m\">4</span>.1.1\n</code></pre></div>\n<p>你可以通过运行 <code class=\"docutils literal notranslate\"><span class=\"pre\">git</span> <span class=\"pre\">tag</span> <span class=\"pre\">--verify</span> <span class=\"pre\">&lt;tag&gt;</span></code> 来检查你的工作。</p>\n</li>\n<li><p>确保你的代码库是绝对干净的，通过运行 <code class=\"docutils literal notranslate\"><span class=\"pre\">git</span> <span class=\"pre\">clean</span> <span class=\"pre\">-dfx</span></code>。</p></li>\n<li><p>Run <code class=\"docutils literal notranslate\"><span class=\"pre\">python</span> <span class=\"pre\">-m</span> <span class=\"pre\">build</span></code> to generate the release packages. This will create\nthe release artifacts (tarball and wheel) in a <code class=\"docutils literal notranslate\"><span class=\"pre\">dist/</span></code> directory. For\nDjango 5.0 or older, you need to run <code class=\"docutils literal notranslate\"><span class=\"pre\">make</span> <span class=\"pre\">-f</span> <span class=\"pre\">extras/Makefile</span></code> instead.</p></li>\n<li><p>生成发布包的哈希值：</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span><span class=\"nb\">cd</span><span class=\"w\"> </span>dist\n$<span class=\"w\"> </span>md5sum<span class=\"w\"> </span>*\n$<span class=\"w\"> </span>sha1sum<span class=\"w\"> </span>*\n$<span class=\"w\"> </span>sha256sum<span class=\"w\"> </span>*\n</code></pre></div>\n</li>\n<li><p>创建一个名为 <code class=\"docutils literal notranslate\"><span class=\"pre\">Django-&lt;&lt;VERSION&gt;&gt;.checksum.txt</span></code> 的 &quot;checksums&quot; 文件，其中包含哈希值和发布信息。使用以下模板，并插入正确的版本、日期、GPG 密钥 ID（从 <code class=\"docutils literal notranslate\"><span class=\"pre\">gpg</span> <span class=\"pre\">--list-keys</span> <span class=\"pre\">--keyid-format</span> <span class=\"pre\">LONG</span></code> 获取）、发布管理器的 GitHub 用户名、发布 URL 和哈希值：</p>\n<div class=\"code-block\" data-language=\"text\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Text</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Text code\"><code>This file contains MD5, SHA1, and SHA256 checksums for the source-code\ntarball and wheel files of Django &lt;&lt;VERSION&gt;&gt;, released &lt;&lt;DATE&gt;&gt;.\n\nTo use this file, you will need a working install of PGP or other\ncompatible public-key encryption software. You will also need to have\nthe Django release manager&#39;s public key in your keyring. This key has\nthe ID ``XXXXXXXXXXXXXXXX`` and can be imported from GitHub, for example,\nif using the open-source GNU Privacy Guard implementation of PGP:\n\n    curl https://github.com/&lt;&lt;RELEASE MANAGER GITHUB USERNAME&gt;&gt;.gpg | gpg --import -\n\nOnce the key is imported, verify this file:\n\n    gpg --verify &lt;&lt;THIS FILENAME&gt;&gt;\n\nOnce you have verified this file, you can use normal MD5, SHA1, or SHA256\nchecksumming applications to generate the checksums of the Django\npackage and compare them to the checksums listed below.\n\nRelease packages\n================\n\nhttps://www.djangoproject.com/download/&lt;&lt;VERSION&gt;&gt;/tarball/\nhttps://www.djangoproject.com/download/&lt;&lt;VERSION&gt;&gt;/wheel/\n\nMD5 checksums\n=============\n\n&lt;&lt;MD5SUM&gt;&gt;  &lt;&lt;RELEASE TAR.GZ FILENAME&gt;&gt;\n&lt;&lt;MD5SUM&gt;&gt;  &lt;&lt;RELEASE WHL FILENAME&gt;&gt;\n\nSHA1 checksums\n==============\n\n&lt;&lt;SHA1SUM&gt;&gt;  &lt;&lt;RELEASE TAR.GZ FILENAME&gt;&gt;\n&lt;&lt;SHA1SUM&gt;&gt;  &lt;&lt;RELEASE WHL FILENAME&gt;&gt;\n\nSHA256 checksums\n================\n\n&lt;&lt;SHA256SUM&gt;&gt;  &lt;&lt;RELEASE TAR.GZ FILENAME&gt;&gt;\n&lt;&lt;SHA256SUM&gt;&gt;  &lt;&lt;RELEASE WHL FILENAME&gt;&gt;\n</code></pre></div>\n</li>\n<li><p>签名 &quot;checksum&quot; 文件（<code class=\"docutils literal notranslate\"><span class=\"pre\">gpg</span> <span class=\"pre\">--clearsign</span> <span class=\"pre\">--digest-algo</span> <span class=\"pre\">SHA256</span> <span class=\"pre\">Django-&lt;version&gt;.checksum.txt</span></code>）。这将生成一个已签名的文档，<code class=\"docutils literal notranslate\"><span class=\"pre\">Django-&lt;version&gt;.checksum.txt.asc</span></code>，你可以使用 <code class=\"docutils literal notranslate\"><span class=\"pre\">gpg</span> <span class=\"pre\">--verify</span> <span class=\"pre\">Django-&lt;version&gt;.checksum.txt.asc</span></code> 来验证它。</p></li>\n</ol>\n</section>\n</section>\n<section id=\"making-the-release-s-available-to-the-public\">\n<h2>将发布版本提供给公众<a class=\"heading-anchor\" href=\"#making-the-release-s-available-to-the-public\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>现在，你准备好将发布版本发布出去了。为了做到这一点：</p>\n<ol class=\"arabic\">\n<li><p>Create a new <code class=\"docutils literal notranslate\"><span class=\"pre\">Release</span></code> entry in the <a class=\"reference external\" href=\"https://www.djangoproject.com/admin/releases/release/add/\">djangoproject.com's admin</a>. If this is a\nsecurity release, this should be done 15 minutes before the announced\nrelease time, no sooner:</p>\n<dl class=\"simple\">\n<dt>版本</dt><dd><p>Must match the version number as defined in the tarball\n(<code class=\"docutils literal notranslate\"><span class=\"pre\">django-&lt;version&gt;.tar.gz</span></code>). For example: &quot;5.2&quot;, &quot;4.1.1&quot;, or &quot;4.2rc1&quot;.</p>\n</dd>\n<dt>Is active</dt><dd><p>Set to False until the release is fully published (last step).</p>\n</dd>\n<dt>LTS</dt><dd><p>Enable if the release is part of an <abbr title=\"Long Term Support\">LTS</abbr>\nbranch.</p>\n</dd>\n<dt>Dates</dt><dd><p>Set the release date to today. This release will not be published until\n<code class=\"docutils literal notranslate\"><span class=\"pre\">is_active</span></code> is enabled.</p>\n</dd>\n<dt>Artifacts</dt><dd><p>Upload the tarball (<code class=\"docutils literal notranslate\"><span class=\"pre\">django-&lt;version&gt;.tar.gz</span></code>), wheel\n(<code class=\"docutils literal notranslate\"><span class=\"pre\">django-&lt;version&gt;-py3-none-any.whl</span></code>), and checksum\n(<code class=\"docutils literal notranslate\"><span class=\"pre\">django-&lt;version&gt;.checksum.txt.asc</span></code>) files created earlier.</p>\n</dd>\n</dl>\n</li>\n<li><p>Test that the release packages install correctly using <code class=\"docutils literal notranslate\"><span class=\"pre\">pip</span></code>. Here's one\nsimple method (this just tests that the binaries are available, that they\ninstall correctly, and that migrations and the development server start, but\nit'll catch silly mistakes):\n<a class=\"reference external\" href=\"https://code.djangoproject.com/wiki/ReleaseTestNewVersion\">https://code.djangoproject.com/wiki/ReleaseTestNewVersion</a>.</p></li>\n<li><p>在 Jenkins 上运行 <a class=\"reference external\" href=\"https://djangoci.com/job/confirm-release/\">confirm-release</a> 构建，以验证 checksum 文件（例如，对于 <a class=\"reference external\" href=\"https://media.djangoproject.com/pgp/Django-4.2rc1.checksum.txt\">https://media.djangoproject.com/pgp/Django-4.2rc1.checksum.txt</a>，使用 <code class=\"docutils literal notranslate\"><span class=\"pre\">4.2rc1</span></code>）。</p>\n</li>\n<li><p>将发布包上传到 PyPI（对于预发布版本，只上传 wheel 文件）：</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span>twine<span class=\"w\"> </span>upload<span class=\"w\"> </span>--repository<span class=\"w\"> </span>django<span class=\"w\"> </span>dist/*\n</code></pre></div>\n</li>\n<li><p>Update the newly created <code class=\"docutils literal notranslate\"><span class=\"pre\">Release</span></code> in the admin in <code class=\"docutils literal notranslate\"><span class=\"pre\">djangoproject.com</span></code>\nand enable the <code class=\"docutils literal notranslate\"><span class=\"pre\">is_active</span></code> flag.</p></li>\n<li><p>推送你的工作和新标签：</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span>git<span class=\"w\"> </span>push\n$<span class=\"w\"> </span>git<span class=\"w\"> </span>push<span class=\"w\"> </span>--tags\n</code></pre></div>\n</li>\n<li><p>发布公告发布的博客文章。</p></li>\n<li><p>对于新版本发布（例如 4.1、4.2），通过将 <code class=\"docutils literal notranslate\"><span class=\"pre\">docs.djangoproject.com</span></code> 数据库中适当的 <code class=\"docutils literal notranslate\"><span class=\"pre\">DocumentRelease</span></code> 对象上的 <code class=\"docutils literal notranslate\"><span class=\"pre\">is_default</span></code> 标志设置为 <code class=\"docutils literal notranslate\"><span class=\"pre\">True</span></code> 来更新文档的默认稳定版本（这将自动将其设置为 <code class=\"docutils literal notranslate\"><span class=\"pre\">False</span></code>，对于所有其他版本）；你可以使用站点的管理员界面来完成这个操作。</p>\n<p>为每种语言创建新的 <code class=\"docutils literal notranslate\"><span class=\"pre\">DocumentRelease</span></code> 对象，这些语言在之前的发布中有条目。通过从 <a class=\"reference external\" href=\"https://github.com/django/djangoproject.com/blob/main/djangoproject/static/robots.docs.txt\">django-docs-translations 仓库</a> 的当前稳定分支运行命令 <code class=\"docutils literal notranslate\"><span class=\"pre\">manage_translations.py</span> <span class=\"pre\">robots_txt</span></code> 生成的结果，更新 djangoproject.com 的 <a class=\"reference external\" href=\"https://github.com/django/django-docs-translations\">robots.docs.txt</a> 文件。例如，当发布 Django 4.2 时：</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span>git<span class=\"w\"> </span>checkout<span class=\"w\"> </span>stable/4.2.x\n$<span class=\"w\"> </span>git<span class=\"w\"> </span>pull\n$<span class=\"w\"> </span>python<span class=\"w\"> </span>manage_translations.py<span class=\"w\"> </span>robots_txt\n</code></pre></div>\n</li>\n<li><p>Post the release announcement to the <a class=\"reference internal\" href=\"/zh-hans/5.2/internals/mailing-lists/#django-announce-mailing-list\"><span class=\"std std-ref\">django-announce</span></a> mailing list and the\nDjango Forum. This should include a link to the announcement blog post.</p></li>\n<li><p>如果这是一个安全发布，请发送单独的电子邮件到 <a class=\"reference external\" href=\"mailto:oss-security&#37;&#52;&#48;lists&#46;openwall&#46;com\">oss-security<span>&#64;</span>lists<span>&#46;</span>openwall<span>&#46;</span>com</a>。提供一个描述性的主题，例如，&quot;Django&quot; 加上发布说明中的问题标题（包括 CVE ID）。消息正文应包括漏洞详细信息，例如，公告博客文章的内容。包括一个指向公告博客文章的链接。</p></li>\n</ol>\n</section>\n<section id=\"post-release\">\n<h2>发布后<a class=\"heading-anchor\" href=\"#post-release\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>你差不多完成了！现在剩下要做的只有：</p>\n<ol class=\"arabic\">\n<li><p>If this is not a pre-release, update the <code class=\"docutils literal notranslate\"><span class=\"pre\">VERSION</span></code> tuple in\n<code class=\"docutils literal notranslate\"><span class=\"pre\">django/__init__.py</span></code> again, incrementing to whatever the next expected\nrelease will be. For example, after releasing 4.1.1, update <code class=\"docutils literal notranslate\"><span class=\"pre\">VERSION</span></code> to\n<code class=\"docutils literal notranslate\"><span class=\"pre\">VERSION</span> <span class=\"pre\">=</span> <span class=\"pre\">(4,</span> <span class=\"pre\">1,</span> <span class=\"pre\">2,</span> <span class=\"pre\">'alpha',</span> <span class=\"pre\">0)</span></code> (<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/a4d19953d46247ee1992b3427fe652e941524272\">example commit</a>).</p></li>\n<li><p>如果需要的话，在 <a class=\"reference external\" href=\"https://code.djangoproject.com/admin/ticket/versions\">Trac 的版本列表</a> 中添加发布（如果是最终发布，请通过修改 code.djangoproject.com 的 <a class=\"reference external\" href=\"https://github.com/django/code.djangoproject.com/blob/main/trac-env/conf/trac.ini\">trac.ini</a> 中的 <code class=\"docutils literal notranslate\"><span class=\"pre\">default_version</span></code> 设置将其设置为默认版本）。新的 X.Y 版本应该在 alpha 发布之后添加，并且在 &quot;点零&quot; 发布之后更新默认版本。</p>\n</li>\n<li><p>如果这是一个最终发布：</p>\n<ol class=\"arabic simple\">\n<li><p>更新当前稳定分支并删除 Trac 上 <a class=\"reference external\" href=\"https://code.djangoproject.com/#Djangoreleaseprocess\">Django 发布过程</a> 中的预发布分支。</p></li>\n<li><p>更新 djangoproject.com 的下载页面（<a class=\"reference external\" href=\"https://github.com/django/djangoproject.com/pull/1444\">示例 PR</a>）。</p></li>\n</ol>\n</li>\n<li><p>如果这是一个安全发布，请更新 <a class=\"reference internal\" href=\"/zh-hans/5.2/releases/security/\"><span class=\"doc\">安全问题档案</span></a>，提供解决问题的详细信息。</p></li>\n<li><p>If this was a pre-release, the translation catalogs need to be updated:</p>\n<ol class=\"arabic\">\n<li><p>Make a new branch from the recently released stable branch:</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>git<span class=\"w\"> </span>checkout<span class=\"w\"> </span>stable/A.B.x\ngit<span class=\"w\"> </span>checkout<span class=\"w\"> </span>-b<span class=\"w\"> </span>update-translations-catalog-A.B.x\n</code></pre></div>\n</li>\n<li><p>Ensure that the release's dedicated virtual environment is enabled and\nrun the following:</p>\n<div class=\"code-block\" data-language=\"shell\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Shell code\"><code>$<span class=\"w\"> </span><span class=\"nb\">cd</span><span class=\"w\"> </span>django\n$<span class=\"w\"> </span>django-admin<span class=\"w\"> </span>makemessages<span class=\"w\"> </span>-l<span class=\"w\"> </span>en<span class=\"w\"> </span>--domain<span class=\"o\">=</span>djangojs<span class=\"w\"> </span>--domain<span class=\"o\">=</span>django\nprocessing<span class=\"w\"> </span>locale<span class=\"w\"> </span>en\n</code></pre></div>\n</li>\n<li><p>Review the diff before pushing and avoid committing changes to the\n<code class=\"docutils literal notranslate\"><span class=\"pre\">.po</span></code> files without any new translations (<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/d2b1ec551567c208abfdd21b27ff6d08ae1a6371\">example commit</a>).</p></li>\n<li><p>Make a pull request against the corresponding stable branch and merge\nonce approved.</p></li>\n<li><p>Forward port the updated source translations to the <code class=\"docutils literal notranslate\"><span class=\"pre\">main</span></code> branch\n(<a class=\"extlink-commit reference external\" href=\"https://github.com/django/django/commit/aed303aff57ac990894b6354af001b0e8ea55f71\">example commit</a>).</p></li>\n</ol>\n</li>\n<li><p>If this was an <code class=\"docutils literal notranslate\"><span class=\"pre\">rc</span></code> pre-release, call for translations for the upcoming\nrelease in the <a class=\"reference external\" href=\"https://forum.djangoproject.com/c/internals/i18n/14\">Django Forum - Internationalization category</a>.</p></li>\n</ol>\n</section>\n<section id=\"notes-on-setting-the-version-tuple\">\n<h2>关于设置 VERSION 元组的注意事项<a class=\"heading-anchor\" href=\"#notes-on-setting-the-version-tuple\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django 的版本报告受控于 <code class=\"docutils literal notranslate\"><span class=\"pre\">django/__init__.py</span></code> 中的 <code class=\"docutils literal notranslate\"><span class=\"pre\">VERSION</span></code> 元组。这是一个包含五个元素的元组，其元素分别是：</p>\n<ol class=\"arabic simple\">\n<li><p>主要版本。</p></li>\n<li><p>次要版本。</p></li>\n<li><p>微版本。</p></li>\n<li><p>状态 -- 可以是 &quot;alpha&quot;、&quot;beta&quot;、&quot;rc&quot; 或 &quot;final&quot; 中的一个。</p></li>\n<li><p>系列号，用于按顺序运行的 alpha/beta/RC 包（例如，&quot;beta 1&quot;、&quot;beta 2&quot; 等）。</p></li>\n</ol>\n<p>对于最终发布，状态始终为 &quot;final&quot;，系列号始终为 0。状态为 &quot;alpha&quot; 的系列号为 0 将被报告为 &quot;pre-alpha&quot;。</p>\n<p>一些示例：</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">(4,</span> <span class=\"pre\">1,</span> <span class=\"pre\">1,</span> <span class=\"pre\">&quot;final&quot;,</span> <span class=\"pre\">0)</span></code> → &quot;4.1.1&quot;</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">(4,</span> <span class=\"pre\">2,</span> <span class=\"pre\">0,</span> <span class=\"pre\">&quot;alpha&quot;,</span> <span class=\"pre\">0)</span></code> → &quot;4.2 pre-alpha&quot;</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">(4,</span> <span class=\"pre\">2,</span> <span class=\"pre\">0,</span> <span class=\"pre\">&quot;beta&quot;,</span> <span class=\"pre\">1)</span></code> → &quot;4.2 beta 1&quot;</p></li>\n</ul>\n</section>","rootId":"how-to-release-django","toc":[{"title":"概况","anchor":"overview","children":[]},{"title":"先决条件","anchor":"prerequisites","children":[]},{"title":"发布前的任务","anchor":"pre-release-tasks","children":[{"title":"安全发布前 10 天（或更早）","anchor":"or-more-days-before-a-security-release","children":[]},{"title":"安全发布前一周","anchor":"a-week-before-a-security-release","children":[]},{"title":"任何发布前几天","anchor":"a-few-days-before-any-release","children":[{"title":"A few days before a feature freeze","anchor":"a-few-days-before-a-feature-freeze","children":[]}]}]},{"title":"Feature freeze tasks","anchor":"feature-freeze-tasks","children":[]},{"title":"实际发布版本","anchor":"actually-rolling-the-release","children":[{"title":"Building the artifacts","anchor":"building-the-artifacts","children":[]}]},{"title":"将发布版本提供给公众","anchor":"making-the-release-s-available-to-the-public","children":[]},{"title":"发布后","anchor":"post-release","children":[]},{"title":"关于设置 VERSION 元组的注意事项","anchor":"notes-on-setting-the-version-tuple","children":[]}],"breadcrumbs":[{"docname":"internals/index","title":"Django内部","url":"/zh-hans/5.2/internals/"}],"prev":{"docname":"internals/git","title":"Django源代码库","url":"/zh-hans/5.2/internals/git/"},"next":null,"formats":{"html":"/zh-hans/5.2/internals/howto-release-django/","markdown":"/zh-hans/5.2/internals/howto-release-django.md","json":"/zh-hans/5.2/internals/howto-release-django.json"},"source":"https://github.com/django/django/blob/stable/5.2.x/docs/internals/howto-release-django.txt","official":"https://docs.djangoproject.com/zh-hans/5.2/internals/howto-release-django/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0"],"inLocales":["en","sv","zh-hans","ga","fr","ja","id","it","pt-br","ko","es","el","pl"]}