{"title":"The Django source code repository","version":"dev","locale":"en","docname":"internals/git","url":"/en/dev/internals/git/","canonical":"https://djangodocs.dev/en/dev/internals/git/","summary":"When deploying a Django application into a real production environment, you will almost always want to use an official packaged release of Django . However, if…","html":"<h1>The Django source code repository<a class=\"heading-anchor\" href=\"#the-django-source-code-repository\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>When deploying a Django application into a real production environment, you\nwill almost always want to use <a class=\"reference external\" href=\"https://www.djangoproject.com/download/\">an official packaged release of Django</a>.</p>\n<p>However, if you’d like to try out in-development code from an upcoming release\nor contribute to the development of Django, you’ll need to obtain a clone of\nDjango’s source code repository.</p>\n<p>This document covers the way the code repository is laid out and how to work\nwith and find things in it.</p>\n<section id=\"high-level-overview\">\n<h2>High-level overview<a class=\"heading-anchor\" href=\"#high-level-overview\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>The Django source code repository uses <a class=\"reference external\" href=\"https://git-scm.com/\">Git</a> to track changes to the code\nover time, so you’ll need a copy of the Git client (a program called <code class=\"docutils literal notranslate\"><span class=\"pre\">git</span></code>)\non your computer, and you’ll want to familiarize yourself with the basics of\nhow Git works.</p>\n<p>Git’s website offers downloads for various operating systems. The site also\ncontains vast amounts of <a class=\"reference external\" href=\"https://git-scm.com/doc\">documentation</a>.</p>\n<p>The Django Git repository is located online at <a class=\"reference external\" href=\"https://github.com/django/django\">github.com/django/django</a>. It contains the full source code for all\nDjango releases, which you can browse online.</p>\n<p>The Git repository includes several <a class=\"reference external\" href=\"https://github.com/django/django/branches\">branches</a>:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">main</span></code> contains the main in-development code which will become\nthe next packaged release of Django. This is where most development\nactivity is focused.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">stable/A.B.x</span></code> are the branches where release preparation work happens.\nThey are also used for bugfix and security releases which occur as necessary\nafter the initial release of a feature version.</p></li>\n</ul>\n<p>The Git repository also contains <a class=\"reference external\" href=\"https://github.com/django/django/tags\">tags</a>. These are the exact revisions from\nwhich packaged Django releases were produced, since version 1.0.</p>\n<p>A number of tags also exist under the <code class=\"docutils literal notranslate\"><span class=\"pre\">archive/</span></code> prefix for <a class=\"reference internal\" href=\"#archived-feature-development-work\"><span class=\"std std-ref\">archived\nwork</span></a>.</p>\n<p>The source code for the <a class=\"reference external\" href=\"https://www.djangoproject.com/\">Djangoproject.com</a>\nwebsite can be found at <a class=\"reference external\" href=\"https://github.com/django/djangoproject.com\">github.com/django/djangoproject.com</a>.</p>\n</section>\n<section id=\"the-main-branch\">\n<h2>The main branch<a class=\"heading-anchor\" href=\"#the-main-branch\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>If you’d like to try out the in-development code for the next release of\nDjango, or if you’d like to contribute to Django by fixing bugs or developing\nnew features, you’ll want to get the code from the main branch.</p>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">Note</p>\n<p>Prior to March 2021, the main branch was called <code class=\"docutils literal notranslate\"><span class=\"pre\">master</span></code>.</p>\n</aside>\n<p>Note that this will get <em>all</em> of Django: in addition to the top-level\n<code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code> module containing Python code, you’ll also get a copy of Django’s\ndocumentation, test suite, packaging scripts and other miscellaneous bits.\nDjango’s code will be present in your clone as a directory named\n<code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code>.</p>\n<p>To try out the in-development code with your own applications, place the\ndirectory containing your clone on your Python import path. Then <code class=\"docutils literal notranslate\"><span class=\"pre\">import</span></code>\nstatements which look for Django will find the <code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code> module within your\nclone.</p>\n<p>If you’re going to be working on Django’s code (say, to fix a bug or\ndevelop a new feature), you can probably stop reading here and move\nover to <a class=\"reference internal\" href=\"/en/dev/internals/contributing/\"><span class=\"doc\">the documentation for contributing to Django</span></a>, which covers things like the preferred\ncoding style and how to generate and submit a patch.</p>\n</section>\n<section id=\"stable-branches\">\n<h2>Stable branches<a class=\"heading-anchor\" href=\"#stable-branches\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django uses branches to prepare for releases of Django. Each major release\nseries has its own stable branch.</p>\n<p>These branches can be found in the repository as <code class=\"docutils literal notranslate\"><span class=\"pre\">stable/A.B.x</span></code>\nbranches and will be created right after the first alpha is tagged.</p>\n<p>For example, immediately after <em>Django 1.5 alpha 1</em> was tagged, the branch\n<code class=\"docutils literal notranslate\"><span class=\"pre\">stable/1.5.x</span></code> was created and all further work on preparing the code for the\nfinal 1.5 release was done there.</p>\n<p>These branches also provide bugfix and security support as described in\n<a class=\"reference internal\" href=\"/en/dev/internals/release-process/#supported-versions-policy\"><span class=\"std std-ref\">Supported versions</span></a>.</p>\n<p>For example, after the release of Django 1.5, the branch <code class=\"docutils literal notranslate\"><span class=\"pre\">stable/1.5.x</span></code>\nreceives only fixes for security and critical stability bugs, which are\neventually released as Django 1.5.1 and so on, <code class=\"docutils literal notranslate\"><span class=\"pre\">stable/1.4.x</span></code> receives only\nsecurity and data loss fixes, and <code class=\"docutils literal notranslate\"><span class=\"pre\">stable/1.3.x</span></code> no longer receives any\nupdates.</p>\n<aside class=\"admonition-historical-information admonition\">\n<p class=\"admonition-title\">Historical information</p>\n<p>This policy for handling <code class=\"docutils literal notranslate\"><span class=\"pre\">stable/A.B.x</span></code> branches was adopted starting\nwith the Django 1.5 release cycle.</p>\n<p>Previously, these branches weren’t created until right after the releases\nand the stabilization work occurred on the main repository branch. Thus,\nno new feature development work for the next release of Django could be\ncommitted until the final release happened.</p>\n<p>For example, shortly after the release of Django 1.3 the branch\n<code class=\"docutils literal notranslate\"><span class=\"pre\">stable/1.3.x</span></code> was created. Official support for that release has\nexpired, and so it no longer receives direct maintenance from the Django\nproject. However, that and all other similarly named branches continue to\nexist, and interested community members have occasionally used them to\nprovide unofficial support for old Django releases.</p>\n</aside>\n</section>\n<section id=\"id1\">\n<h2>Tags<a class=\"heading-anchor\" href=\"#id1\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Each Django release is tagged and signed by the releaser.</p>\n<p>The tags can be found on GitHub’s <a class=\"reference external\" href=\"https://github.com/django/django/tags\">tags</a> page.</p>\n<section id=\"archived-feature-development-work\">\n<span id=\"id3\"></span><h3>Archived feature-development work<a class=\"heading-anchor\" href=\"#archived-feature-development-work\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<aside class=\"admonition-historical-information admonition\">\n<p class=\"admonition-title\">Historical information</p>\n<p>Since Django moved to Git in 2012, anyone can clone the repository and\ncreate their own branches, alleviating the need for official branches in\nthe source code repository.</p>\n<p>The following section is mostly useful if you’re exploring the repository’s\nhistory, for example if you’re trying to understand how some features were\ndesigned.</p>\n</aside>\n<p>Feature-development branches tend by their nature to be temporary. Some\nproduce successful features which are merged back into Django’s main branch to\nbecome part of an official release, but others do not; in either case, there\ncomes a time when the branch is no longer being actively worked on by any\ndeveloper. At this point the branch is considered closed.</p>\n<p>Django used to be maintained with the Subversion revision control system, that\nhas no standard way of indicating this. As a workaround, branches of Django\nwhich are closed and no longer maintained were moved into <code class=\"docutils literal notranslate\"><span class=\"pre\">attic</span></code>.</p>\n<p>A number of tags exist under the <code class=\"docutils literal notranslate\"><span class=\"pre\">archive/</span></code> prefix to maintain a reference to\nthis and other work of historical interest.</p>\n<p>The following tags under the <code class=\"docutils literal notranslate\"><span class=\"pre\">archive/attic/</span></code> prefix reference the tip of\nbranches whose code eventually became part of Django itself:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">boulder-oracle-sprint</span></code>: Added support for Oracle databases to\nDjango’s object-relational mapper. This has been part of Django\nsince the 1.0 release.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">gis</span></code>: Added support for geographic/spatial queries to Django’s\nobject-relational mapper. This has been part of Django since the 1.0\nrelease, as the bundled application <code class=\"docutils literal notranslate\"><span class=\"pre\">django.contrib.gis</span></code>.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">i18n</span></code>: Added <a class=\"reference internal\" href=\"/en/dev/topics/i18n/\"><span class=\"doc\">internationalization support</span></a> to\nDjango. This has been part of Django since the 0.90 release.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">magic-removal</span></code>: A major refactoring of both the internals and\npublic APIs of Django’s object-relational mapper. This has been part\nof Django since the 0.95 release.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">multi-auth</span></code>: A refactoring of <a class=\"reference internal\" href=\"/en/dev/topics/auth/\"><span class=\"doc\">Django’s bundled\nauthentication framework</span></a> which added support for\n<a class=\"reference internal\" href=\"/en/dev/topics/auth/customizing/#authentication-backends\"><span class=\"std std-ref\">authentication backends</span></a>. This has\nbeen part of Django since the 0.95 release.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">new-admin</span></code>: A refactoring of <a class=\"reference internal\" href=\"/en/dev/ref/contrib/admin/\"><span class=\"doc\">Django’s bundled\nadministrative application</span></a>. This became part of\nDjango as of the 0.91 release, but was superseded by another\nrefactoring (see next listing) prior to the Django 1.0 release.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">newforms-admin</span></code>: The second refactoring of Django’s bundled\nadministrative application. This became part of Django as of the 1.0\nrelease, and is the basis of the current incarnation of\n<code class=\"docutils literal notranslate\"><span class=\"pre\">django.contrib.admin</span></code>.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">queryset-refactor</span></code>: A refactoring of the internals of Django’s\nobject-relational mapper. This became part of Django as of the 1.0\nrelease.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">unicode</span></code>: A refactoring of Django’s internals to consistently use\nUnicode-based strings in most places within Django and Django\napplications. This became part of Django as of the 1.0 release.</p></li>\n</ul>\n<p>Additionally, the following tags under the <code class=\"docutils literal notranslate\"><span class=\"pre\">archive/attic/</span></code> prefix reference\nthe tips of branches that were closed, but whose code was never merged into\nDjango, and the features they aimed to implement were never finished:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">full-history</span></code></p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">generic-auth</span></code></p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">multiple-db-support</span></code></p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">per-object-permissions</span></code></p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">schema-evolution</span></code></p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">schema-evolution-ng</span></code></p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">search-api</span></code></p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">sqlalchemy</span></code></p></li>\n</ul>\n<p>Finally, under the <code class=\"docutils literal notranslate\"><span class=\"pre\">archive/</span></code> prefix, the repository contains\n<code class=\"docutils literal notranslate\"><span class=\"pre\">soc20XX/&lt;project&gt;</span></code> tags referencing the tip of branches that were used by\nstudents who worked on Django during the 2009 and 2010 Google Summer of Code\nprograms.</p>\n</section>\n</section>","rootId":"the-django-source-code-repository","toc":[{"title":"High-level overview","anchor":"high-level-overview","children":[]},{"title":"The main branch","anchor":"the-main-branch","children":[]},{"title":"Stable branches","anchor":"stable-branches","children":[]},{"title":"Tags","anchor":"id1","children":[{"title":"Archived feature-development work","anchor":"archived-feature-development-work","children":[]}]}],"breadcrumbs":[{"docname":"internals/index","title":"Django internals","url":"/en/dev/internals/"}],"prev":{"docname":"internals/deprecation","title":"Django Deprecation Timeline","url":"/en/dev/internals/deprecation/"},"next":{"docname":"internals/howto-release-django","title":"How to release Django","url":"/en/dev/internals/howto-release-django/"},"formats":{"html":"/en/dev/internals/git/","markdown":"/en/dev/internals/git.md","json":"/en/dev/internals/git.json"},"source":"https://github.com/django/django/blob/main/docs/internals/git.txt","official":"https://docs.djangoproject.com/en/dev/internals/git/","inVersions":["dev","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","1.11","1.10","1.9","1.8"],"inLocales":["en"]}