{"title":"Django 的发行流程","version":"5.1","locale":"zh-hans","docname":"internals/release-process","url":"/zh-hans/5.1/internals/release-process/","canonical":"https://djangodocs.dev/zh-hans/5.1/internals/release-process/","summary":"正式发行 Link to this heading # 从 1.0 版本开始，Django 的发行编号如下方式工作： 版本编号为 A.B 或 A.B.C 形式。 A.B 是 功能发行 的版本号。每个版本都将基本向后兼容前一个版本。这个规则的例外情况将在发行说明中列出。 C 是 补丁发行…","html":"<h1>Django 的发行流程<a class=\"heading-anchor\" href=\"#django-s-release-process\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<section id=\"official-releases\">\n<span id=\"id1\"></span><h2>正式发行<a class=\"heading-anchor\" href=\"#official-releases\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>从 1.0 版本开始，Django 的发行编号如下方式工作：</p>\n<ul class=\"simple\">\n<li><p>版本编号为 <code class=\"docutils literal notranslate\"><span class=\"pre\">A.B</span></code> 或 <code class=\"docutils literal notranslate\"><span class=\"pre\">A.B.C</span></code> 形式。</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">A.B</span></code> 是 <em>功能发行</em> 的版本号。每个版本都将基本向后兼容前一个版本。这个规则的例外情况将在发行说明中列出。</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">C</span></code> 是 <em>补丁发行</em> 的版本号，对于错误修复和安全发行来说，它是递增的。这些版本将 100% 向后兼容前一个补丁版本。唯一的例外是当有一个安全或数据丢失的问题无法在不破坏向后兼容的情况下被修复。如果发生这种情况，发行说明将提供详细的升级说明。</p></li>\n<li><p>在一个新的功能发行之前，我们会发布 alpha、beta 和候选发行。这些发行的形式是 <code class=\"docutils literal notranslate\"><span class=\"pre\">A.B</span> <span class=\"pre\">alpha/beta/rc</span> <span class=\"pre\">N</span></code>，意思是 <code class=\"docutils literal notranslate\"><span class=\"pre\">A.B</span></code> 版本的第 <code class=\"docutils literal notranslate\"><span class=\"pre\">N</span></code> 个 alpha/beta/候选发行。</p></li>\n</ul>\n<p>在 git 中，每个 Django 发行都会有一个标签，表示它的版本号，用 Django 的发行密钥签名。此外，每个发行系列都有自己的分支，称为 <code class=\"docutils literal notranslate\"><span class=\"pre\">stable/A.B.x</span></code>，bugfix/security 版本将从这些分支发布。</p>\n<p>关于 Django 项目如何出于安全目的发布新版本的更多信息，请参见 <a class=\"reference internal\" href=\"/zh-hans/5.1/internals/security/\"><span class=\"doc\">我们的安全政策</span></a>。</p>\n<dl class=\"glossary\">\n<dt id=\"term-Feature-release\">功能发行<a class=\"heading-anchor\" href=\"#term-Feature-release\"><span class=\"visually-hidden\">Link to this term</span><span aria-hidden=\"true\">#</span></a></dt><dd><p>功能发行（A.B，A.B+1，等等）大约每 8 个月进行一次 —— 详情请见 <a class=\"reference internal\" href=\"#id2\">release process</a> 。这些发行将包含新的功能，对现有功能的改进等等。</p>\n</dd>\n<dt id=\"term-Patch-release\">补丁发行<a class=\"heading-anchor\" href=\"#term-Patch-release\"><span class=\"visually-hidden\">Link to this term</span><span aria-hidden=\"true\">#</span></a></dt><dd><p>补丁版本（A.B.C，A.B.C+1 等等）将根据需要发布，以修复错误和／或安全问题。</p>\n<p>这些版本将与相关的功能版本 100% 兼容，除非由于安全原因或为了防止数据丢失而无法做到。因此，“我应该升级到最新的补丁版本吗？” 的答案将永远是 “是的”。</p>\n</dd>\n<dt id=\"term-Long-term-support-release\">长期支持发行<a class=\"heading-anchor\" href=\"#term-Long-term-support-release\"><span class=\"visually-hidden\">Link to this term</span><span aria-hidden=\"true\">#</span></a></dt><dd><p>某些功能版本将被指定为长期支持（LTS）版本。这些版本将在保证的时间内，通常是三年内得到安全和数据丢失的修复。</p>\n<p>请参见 <a class=\"reference external\" href=\"https://www.djangoproject.com/download/\">the download page</a> ，了解被指定为长期支持的版本。</p>\n</dd>\n</dl>\n</section>\n<section id=\"release-cadence\">\n<span id=\"internal-release-cadence\"></span><h2>发行节奏<a class=\"heading-anchor\" href=\"#release-cadence\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>从 Django 2.0 开始，版本号将使用一种松散的 <a class=\"reference external\" href=\"https://semver.org/\">语义版本</a> ，这样一来，LTS 之后的每个版本都将提升到下一个 “点零” 版本。例如：2.0、2.1、2.2（LTS）、3.0、3.1、3.2（LTS）等等。</p>\n<p>语义版本使人们更容易一目了然地看到各版本之间的兼容情况。它还有助于预测兼容性垫片何时会被移除。这不是一个纯粹的语义版本形式，因为每个功能版本都会继续有一些记录在案的向后不兼容问题，在这些问题上不可能有一个废弃的路径，或者不值得花费。此外，在 LTS 版本（X.2）中开始的弃用将在非零版本（Y.1）中放弃，以适应我们的政策，即至少在两个功能版本中保留弃用的垫片。请继续阅读下一节，了解一个例子。</p>\n</section>\n<section id=\"deprecation-policy\">\n<span id=\"internal-release-deprecation-policy\"></span><h2>废弃政策<a class=\"heading-anchor\" href=\"#deprecation-policy\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>一个功能版本可能会废弃以前版本中的某些功能。如果一个功能在 A.x 版本中被弃用，它将继续在所有 A.x 版本中工作（对于所有版本的 x），但会引发警告。被废弃的功能将在 B.0 版本中移除，如果是在上一个 A.x 版本中废弃的功能，则在 B.1 版本中移除，以确保废弃的功能至少在两个版本中完成。</p>\n<p>因此，举例来说，如果我们决定在 Django 4.2 中开始废止一个函数：</p>\n<ul class=\"simple\">\n<li><p>Django 4.2 将包含一个向后兼容的函数副本，它将引发一个 <code class=\"docutils literal notranslate\"><span class=\"pre\">RemovedInDjango51Warning</span></code>。</p></li>\n<li><p>Django 5.0（4.2 之后的版本）仍将包含向后兼容的副本。</p></li>\n<li><p>Django 5.1 将直接删除该功能。</p></li>\n</ul>\n<p>这些警告在默认情况下是静默的。你可以用 <code class=\"docutils literal notranslate\"><span class=\"pre\">python</span> <span class=\"pre\">-Wd</span></code> 选项打开这些警告的显示。</p>\n<p>一个更普遍的例子：</p>\n<ul class=\"simple\">\n<li><p>X.0</p></li>\n<li><p>X.1</p></li>\n<li><p>X.2 LTS</p></li>\n<li><p>Y.0: 丢弃在 X.0 和 X.1 中添加的废弃垫片。</p></li>\n<li><p>Y.1: 丢弃在 X.2 中添加的废弃垫片。</p></li>\n<li><p>Y.2 LTS: 没有丢弃废弃垫片（虽然 Y.0 不再被支持，但第三方应用程序需要保持回到 X.2 LTS 的兼容性，以方便 LTS 到 LTS 的升级）。</p></li>\n<li><p>Z.0: 丢弃在 Y.0 和 Y.1 中添加的废弃垫片。</p></li>\n</ul>\n<p>也请参见 <a class=\"reference internal\" href=\"/zh-hans/5.1/internals/contributing/writing-code/submitting-patches/#deprecating-a-feature\"><span class=\"std std-ref\">弃用一个功能</span></a> 指南。</p>\n</section>\n<section id=\"supported-versions\">\n<span id=\"supported-versions-policy\"></span><h2>支持的版本<a class=\"heading-anchor\" href=\"#supported-versions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>在任何时候，Django 的开发者团队都会在不同程度上支持一系列的版本。请参阅下载页面的 <a class=\"reference external\" href=\"https://www.djangoproject.com/download/#supported-versions\">支持的版本部分</a> ，了解每个版本的当前支持情况。</p>\n<ul>\n<li><p>目前的开发分支 <code class=\"docutils literal notranslate\"><span class=\"pre\">main</span></code> 将获得需要少量重构的新功能和错误修复。</p></li>\n<li><p>应用于主分支的补丁也必须应用于最后一个功能发行分支，当它们修复关键问题时，将在该功能系列的下一个补丁发行中发布：</p>\n<ul class=\"simple\">\n<li><p>安全问题。</p></li>\n<li><p>数据丢失漏洞。</p></li>\n<li><p>崩溃漏洞。</p></li>\n<li><p>最新稳定发行的新功能中的主要功能漏洞。</p></li>\n<li><p>在当前版本系列中引入的旧版本 Django 的缺陷。</p></li>\n</ul>\n<p>经验法则是，对于那些一开始就会阻止发行的漏洞（发行障碍），修复将被向后移植到最后一个功能发行。</p>\n</li>\n<li><p>安全修复和数据丢失漏洞将被应用于当前的主分支、最后两个功能发行分支以及任何其他支持的长期支持发行分支。</p></li>\n<li><p>一般来说，文档修复会更自由地向后移植到最后一个发行分支。这是因为让最后一个发行的文档是最新的和正确的是非常有利的，而且引入缺陷的风险也更小。</p></li>\n</ul>\n<p>作为一个具体的例子，考虑在 Django 5.1 和 5.2 发布之间的一个时间点。在这个时间点上：</p>\n<ul class=\"simple\">\n<li><p>功能将被添加到开发主分支，作为 Django 5.2 发行。</p></li>\n<li><p>关键漏洞修复将应用于 <code class=\"docutils literal notranslate\"><span class=\"pre\">stable/5.1.x</span></code> 分支，并作为 5.1.1、5.1.2 等发行。</p></li>\n<li><p>安全修复和数据丢失问题的漏洞修复将应用于 <code class=\"docutils literal notranslate\"><span class=\"pre\">main</span></code>、<code class=\"docutils literal notranslate\"><span class=\"pre\">stable/5.1.x</span></code>、<code class=\"docutils literal notranslate\"><span class=\"pre\">stable/5.0.x</span></code> 和 <code class=\"docutils literal notranslate\"><span class=\"pre\">stable/4.2.x</span></code> （LTS）分支。它们将触发 <code class=\"docutils literal notranslate\"><span class=\"pre\">5.1.1</span></code>、<code class=\"docutils literal notranslate\"><span class=\"pre\">5.0.5</span></code>、<code class=\"docutils literal notranslate\"><span class=\"pre\">4.2.8</span></code> 等的发行。</p></li>\n<li><p>文档修复将应用于 main，如果容易向后移植，则应用于最新的稳定分支，<code class=\"docutils literal notranslate\"><span class=\"pre\">5.1.x</span></code>。</p></li>\n</ul>\n</section>\n<section id=\"release-process\">\n<span id=\"id2\"></span><h2>发行过程<a class=\"heading-anchor\" href=\"#release-process\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django 使用了一个基于时间的发行时间表，每八个月左右一次功能发行。</p>\n<p>After each feature release, the release manager will publish a timeline for the\nnext feature release. The timeline for an upcoming feature release can be found\nin the corresponding wiki roadmap page, e.g.\n<a class=\"reference external\" href=\"https://code.djangoproject.com/wiki/Version6.0Roadmap\">https://code.djangoproject.com/wiki/Version6.0Roadmap</a>.</p>\n<section id=\"feature-release-schedule-and-stages\">\n<h3>Feature release schedule and stages<a class=\"heading-anchor\" href=\"#feature-release-schedule-and-stages\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"active-development-pre-feature-freeze\">\n<h4>Active development / Pre-feature freeze<a class=\"heading-anchor\" href=\"#active-development-pre-feature-freeze\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Work begins on the feature release <code class=\"docutils literal notranslate\"><span class=\"pre\">A.B</span></code> after the feature freeze of the\nprevious release, i.e. when the <code class=\"docutils literal notranslate\"><span class=\"pre\">stable/A.B-1.x</span></code> branch is forked.</p>\n<p>You can find the current branch under active development in the\n<a class=\"reference external\" href=\"https://code.djangoproject.com/#Djangoreleaseprocess\">Django release process</a> on Trac.</p>\n</section>\n<section id=\"feature-freeze-alpha-release\">\n<h4>Feature freeze / Alpha release<a class=\"heading-anchor\" href=\"#feature-freeze-alpha-release\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>All major and minor features, including deprecations and breaking changes, must\nbe merged by the feature freeze. Any features not done by this point will be\ndeferred to the next feature release.</p>\n<p>At this point, the <code class=\"docutils literal notranslate\"><span class=\"pre\">stable/A.B.x</span></code> branch will be forked from <code class=\"docutils literal notranslate\"><span class=\"pre\">main</span></code>.</p>\n</section>\n<section id=\"non-release-blocking-bug-fix-freeze-beta-release\">\n<h4>Non-release blocking bug fix freeze / Beta release<a class=\"heading-anchor\" href=\"#non-release-blocking-bug-fix-freeze-beta-release\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>After the alpha, all bug fixes merged in <code class=\"docutils literal notranslate\"><span class=\"pre\">main</span></code> are also backported to\n<code class=\"docutils literal notranslate\"><span class=\"pre\">stable/A.B.x</span></code>. Refactors are backported at the discretion of the merger.\nMergers will be more and more conservative with backports, to avoid introducing\nregressions.</p>\n<p>In parallel to this phase, <code class=\"docutils literal notranslate\"><span class=\"pre\">main</span></code> can continue to receive new features, to be\nreleased in the <code class=\"docutils literal notranslate\"><span class=\"pre\">A.B+1</span></code> cycle.</p>\n</section>\n<section id=\"translation-string-freeze-release-candidate-release\">\n<h4>Translation string freeze / Release candidate release<a class=\"heading-anchor\" href=\"#translation-string-freeze-release-candidate-release\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>If there is still a consistent stream of release blockers coming in at the\nplanned release candidate date, a beta 2 will be released to encourage further\ntesting and the release candidate date will be pushed out ~1 month.</p>\n<p>The release candidate marks the string freeze, and it happens at least two\nweeks before the final release. Translators can then submit updated\ntranslations for inclusion in the final release. After this point, new\ntranslatable strings must not be added.</p>\n<p>After the release candidate, only release blockers and documentation fixes are\nbackported.</p>\n</section>\n<section id=\"final-release\">\n<h4>Final release<a class=\"heading-anchor\" href=\"#final-release\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Ideally, the final release will ship two weeks after the last release\ncandidate.</p>\n<p>If there are major bugs still being found 2 weeks after the release candidate,\nthere will be a decision on how to proceed (likely another release candidate\nwould be issued and the final release date will be pushed out).</p>\n</section>\n</section>\n<section id=\"bug-fix-releases\">\n<h3>漏洞修复发行<a class=\"heading-anchor\" href=\"#bug-fix-releases\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>在一个功能发行（如 A.B）后，之前的版本将进入漏洞修复模式。</p>\n<p>上一个功能发行的分支（例如：<code class=\"docutils literal notranslate\"><span class=\"pre\">stable/A.B-1.x</span></code>）将包括漏洞修复。在 main 上修复的重要漏洞 <em>也</em> 必须在漏洞分支上修复；这意味着提交时需要将漏洞修复和功能添加干净地分开。向 main 提交修复的开发者将负责把该修复应用于当前的漏洞修复分支。</p>\n</section>\n</section>","rootId":"django-s-release-process","toc":[{"title":"正式发行","anchor":"official-releases","children":[]},{"title":"发行节奏","anchor":"release-cadence","children":[]},{"title":"废弃政策","anchor":"deprecation-policy","children":[]},{"title":"支持的版本","anchor":"supported-versions","children":[]},{"title":"发行过程","anchor":"release-process","children":[{"title":"Feature release schedule and stages","anchor":"feature-release-schedule-and-stages","children":[{"title":"Active development / Pre-feature freeze","anchor":"active-development-pre-feature-freeze","children":[]},{"title":"Feature freeze / Alpha release","anchor":"feature-freeze-alpha-release","children":[]},{"title":"Non-release blocking bug fix freeze / Beta release","anchor":"non-release-blocking-bug-fix-freeze-beta-release","children":[]},{"title":"Translation string freeze / Release candidate release","anchor":"translation-string-freeze-release-candidate-release","children":[]},{"title":"Final release","anchor":"final-release","children":[]}]},{"title":"漏洞修复发行","anchor":"bug-fix-releases","children":[]}]}],"breadcrumbs":[{"docname":"internals/index","title":"Django内部","url":"/zh-hans/5.1/internals/"}],"prev":{"docname":"internals/security","title":"Django 的安全策略","url":"/zh-hans/5.1/internals/security/"},"next":{"docname":"internals/deprecation","title":"Django废弃时间表","url":"/zh-hans/5.1/internals/deprecation/"},"formats":{"html":"/zh-hans/5.1/internals/release-process/","markdown":"/zh-hans/5.1/internals/release-process.md","json":"/zh-hans/5.1/internals/release-process.json"},"source":"https://github.com/django/django/blob/stable/5.1.x/docs/internals/release-process.txt","official":"https://docs.djangoproject.com/zh-hans/5.1/internals/release-process/","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","zh-hans","fr","ja","id","it","pt-br","ko","es","el","pl"]}