git.txt 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. =================================
  2. The Django source code repository
  3. =================================
  4. When deploying a Django application into a real production environment, you
  5. will almost always want to use `an official packaged release of Django`_.
  6. However, if you'd like to try out in-development code from an upcoming release
  7. or contribute to the development of Django, you'll need to obtain a clone of
  8. Django's source code repository.
  9. This document covers the way the code repository is laid out and how to work
  10. with and find things in it.
  11. .. _an official packaged release of Django: https://www.djangoproject.com/download/
  12. High-level overview
  13. ===================
  14. The Django source code repository uses `Git`_ to track changes to the code
  15. over time, so you'll need a copy of the Git client (a program called ``git``)
  16. on your computer, and you'll want to familiarize yourself with the basics of
  17. how Git works.
  18. Git's website offers downloads for various operating systems. The site also
  19. contains vast amounts of `documentation`_.
  20. The Django Git repository is located online at `github.com/django/django
  21. <https://github.com/django/django>`_. It contains the full source code for all
  22. Django releases, which you can browse online.
  23. The Git repository includes several `branches`_:
  24. * ``main`` contains the main in-development code which will become
  25. the next packaged release of Django. This is where most development
  26. activity is focused.
  27. * ``stable/A.B.x`` are the branches where release preparation work happens.
  28. They are also used for bugfix and security releases which occur as necessary
  29. after the initial release of a feature version.
  30. The Git repository also contains `tags`_. These are the exact revisions from
  31. which packaged Django releases were produced, since version 1.0.
  32. A number of tags also exist under the ``archive/`` prefix for :ref:`archived
  33. work<archived-feature-development-work>`.
  34. The source code for the `Djangoproject.com <https://www.djangoproject.com/>`_
  35. website can be found at `github.com/django/djangoproject.com
  36. <https://github.com/django/djangoproject.com>`_.
  37. .. _Git: https://git-scm.com/
  38. .. _documentation: https://git-scm.com/doc
  39. .. _branches: https://github.com/django/django/branches
  40. .. _tags: https://github.com/django/django/tags
  41. The main branch
  42. ===============
  43. If you'd like to try out the in-development code for the next release of
  44. Django, or if you'd like to contribute to Django by fixing bugs or developing
  45. new features, you'll want to get the code from the main branch.
  46. .. note::
  47. Prior to March 2021, the main branch was called ``master``.
  48. Note that this will get *all* of Django: in addition to the top-level
  49. ``django`` module containing Python code, you'll also get a copy of Django's
  50. documentation, test suite, packaging scripts and other miscellaneous bits.
  51. Django's code will be present in your clone as a directory named
  52. ``django``.
  53. To try out the in-development code with your own applications, place the
  54. directory containing your clone on your Python import path. Then ``import``
  55. statements which look for Django will find the ``django`` module within your
  56. clone.
  57. If you're going to be working on Django's code (say, to fix a bug or
  58. develop a new feature), you can probably stop reading here and move
  59. over to :doc:`the documentation for contributing to Django
  60. </internals/contributing/index>`, which covers things like the preferred
  61. coding style and how to generate and submit a patch.
  62. Stable branches
  63. ===============
  64. Django uses branches to prepare for releases of Django. Each major release
  65. series has its own stable branch.
  66. These branches can be found in the repository as ``stable/A.B.x``
  67. branches and will be created right after the first alpha is tagged.
  68. For example, immediately after *Django 1.5 alpha 1* was tagged, the branch
  69. ``stable/1.5.x`` was created and all further work on preparing the code for the
  70. final 1.5 release was done there.
  71. These branches also provide bugfix and security support as described in
  72. :ref:`supported-versions-policy`.
  73. For example, after the release of Django 1.5, the branch ``stable/1.5.x``
  74. receives only fixes for security and critical stability bugs, which are
  75. eventually released as Django 1.5.1 and so on, ``stable/1.4.x`` receives only
  76. security and data loss fixes, and ``stable/1.3.x`` no longer receives any
  77. updates.
  78. .. admonition:: Historical information
  79. This policy for handling ``stable/A.B.x`` branches was adopted starting
  80. with the Django 1.5 release cycle.
  81. Previously, these branches weren't created until right after the releases
  82. and the stabilization work occurred on the main repository branch. Thus,
  83. no new feature development work for the next release of Django could be
  84. committed until the final release happened.
  85. For example, shortly after the release of Django 1.3 the branch
  86. ``stable/1.3.x`` was created. Official support for that release has expired,
  87. and so it no longer receives direct maintenance from the Django project.
  88. However, that and all other similarly named branches continue to exist, and
  89. interested community members have occasionally used them to provide
  90. unofficial support for old Django releases.
  91. Tags
  92. ====
  93. Each Django release is tagged and signed by the releaser.
  94. The tags can be found on GitHub's `tags`_ page.
  95. .. _tags: https://github.com/django/django/tags
  96. .. _archived-feature-development-work:
  97. Archived feature-development work
  98. ---------------------------------
  99. .. admonition:: Historical information
  100. Since Django moved to Git in 2012, anyone can clone the repository and
  101. create their own branches, alleviating the need for official branches in
  102. the source code repository.
  103. The following section is mostly useful if you're exploring the repository's
  104. history, for example if you're trying to understand how some features were
  105. designed.
  106. Feature-development branches tend by their nature to be temporary. Some
  107. produce successful features which are merged back into Django's main branch to
  108. become part of an official release, but others do not; in either case, there
  109. comes a time when the branch is no longer being actively worked on by any
  110. developer. At this point the branch is considered closed.
  111. Django used to be maintained with the Subversion revision control system, that
  112. has no standard way of indicating this. As a workaround, branches of Django
  113. which are closed and no longer maintained were moved into ``attic``.
  114. A number of tags exist under the ``archive/`` prefix to maintain a reference to
  115. this and other work of historical interest.
  116. The following tags under the ``archive/attic/`` prefix reference the tip of
  117. branches whose code eventually became part of Django itself:
  118. * ``boulder-oracle-sprint``: Added support for Oracle databases to
  119. Django's object-relational mapper. This has been part of Django
  120. since the 1.0 release.
  121. * ``gis``: Added support for geographic/spatial queries to Django's
  122. object-relational mapper. This has been part of Django since the 1.0
  123. release, as the bundled application ``django.contrib.gis``.
  124. * ``i18n``: Added :doc:`internationalization support </topics/i18n/index>` to
  125. Django. This has been part of Django since the 0.90 release.
  126. * ``magic-removal``: A major refactoring of both the internals and
  127. public APIs of Django's object-relational mapper. This has been part
  128. of Django since the 0.95 release.
  129. * ``multi-auth``: A refactoring of :doc:`Django's bundled
  130. authentication framework </topics/auth/index>` which added support for
  131. :ref:`authentication backends <authentication-backends>`. This has
  132. been part of Django since the 0.95 release.
  133. * ``new-admin``: A refactoring of :doc:`Django's bundled
  134. administrative application </ref/contrib/admin/index>`. This became part of
  135. Django as of the 0.91 release, but was superseded by another
  136. refactoring (see next listing) prior to the Django 1.0 release.
  137. * ``newforms-admin``: The second refactoring of Django's bundled
  138. administrative application. This became part of Django as of the 1.0
  139. release, and is the basis of the current incarnation of
  140. ``django.contrib.admin``.
  141. * ``queryset-refactor``: A refactoring of the internals of Django's
  142. object-relational mapper. This became part of Django as of the 1.0
  143. release.
  144. * ``unicode``: A refactoring of Django's internals to consistently use
  145. Unicode-based strings in most places within Django and Django
  146. applications. This became part of Django as of the 1.0 release.
  147. Additionally, the following tags under the ``archive/attic/`` prefix reference
  148. the tips of branches that were closed, but whose code was never merged into
  149. Django, and the features they aimed to implement were never finished:
  150. * ``full-history``
  151. * ``generic-auth``
  152. * ``multiple-db-support``
  153. * ``per-object-permissions``
  154. * ``schema-evolution``
  155. * ``schema-evolution-ng``
  156. * ``search-api``
  157. * ``sqlalchemy``
  158. Finally, under the ``archive/`` prefix, the repository contains
  159. ``soc20XX/<project>`` tags referencing the tip of branches that were used by
  160. students who worked on Django during the 2009 and 2010 Google Summer of Code
  161. programs.