---
title: "Como o Django é formado?"
version: 4.0
locale: pt-br
source: https://docs.djangoproject.com/pt-br/4.0/internals/howto-release-django/
canonical: https://djangodocs.dev/pt-br/4.0/internals/howto-release-django/
---
# Como o Django é formado?

Este documento explica como fazer uma release do Django.

**Por favor, mantenha essas instruções atualizadas se você fizer mudanças!** A ideia aqui é ser descritivo, não prescritivo, então sinta-se à vontade para agilizar ou por outro lado fazer mudanças, mas **atualize este documento de acordo**

## Visão Geral

Existem três tipos de releases que você pode precisar fazer:

- Releases de segurança: divulgação e correção de uma vulnerabilidade. Isto provavelmente irá envolver duas ou três release simultâneas – ex. 1.5.x, 1.6.x, e, dependendo do momento, talvez 1.7 alpha/beta/rc.
- Releases de versões regulares: tanto uma release final (ex. 1.5) ou uma atualização de correção de bugs (ex. 1.5.1).
- Pre-release: ex. 1.6 alpha, beta, ou rc.

Uma curta versão dos passos envolvidos é a seguinte:

1. Se esta é uma release de segurança, pre-notificar a lista de distribuição de segurança uma semana antes da release atual.
2. Revisar as notas de release, buscando por melhor organização e erros de escrita. Esboçar um post de blog e um e-mail de anúncio.
3. Atualizar os números de versão e criar um ou mais pacotes de release.
4. Fazer upload do pacote (ou dos pacotes) para o servidor `djangoproject.com`.
5. Fazer upload da nova versão (ou versões) para o PyPI.
6. Declare a nova versão no admin em `djangoproject.com`.
7. Postar a entrada no blog e enviar os anúncios de e-mail.
8. Atualizar os números de versão pós-release.

Existem vários detalhes, então por favor continue lendo.

## Pré-requisitos

Você vai precisar de algumas coisas antes de começar:

- Uma chage GPG. Se a chave que você quer usar não é sua chave de assinatura padrão, você vai precisar adicionar `-u you@example.com` para cada comando de assinatura GPG abaixo, onde `you@example.com` é um endereço de email associado com a chave que você quer usar.
- A instalação de alguns pacotes requeridos pelo Python:

  ```console
  $ python -m pip install wheel twine
  ```
- Acesso ao registro do Django no PyPI. Criar um arquivo com suas credenciais:

  *`~/.pypirc`*

  ```ini
  [pypi]
  username:YourUsername
  password:YourPassword
  ```
- Acessar o servidor de `djangoproject.com` para atualizar os arquivos.
- Acesso para o admin em `djangoproject.com` como um “Site maintainer”.
- Acesso para postar em `django-announce`.
- Se essa é uma release de segurança, acesso para a lista de distribuição de segurança.

If this is your first release, you’ll need to coordinate with another releaser
to get all these things lined up.

## Tarefas de pré-release

Alguns itens precisam ser realizados antes mesmo de começar o processo de release. Isso começa por volta de uma semana antes da release; a maior parte dele pode ser feita a qualquer momento culminando na release em si:

1. If this is a security release, send out pre-notification **one week** before
   the release. The template for that email and a list of the recipients are in
   the private `django-security` GitHub wiki. BCC the pre-notification
   recipients. Sign the email with the key you’ll use for the release and
   include [CVE IDs](https://cveform.mitre.org/) (requested with Vendor:
   djangoproject, Product: django) and patches for each issue being fixed.
   Also, [notify django-announce](/pt-br/4.0/internals/security/#security-disclosure) of the upcoming
   security release.
2. À medida em que a release se aproxima, acompanhe o Track para se certificar de que nenhum problema que possa bloquear a release prestes a ser lançada tenha restado sem solução.
3. Check with the other mergers to make sure they don’t have any uncommitted
   changes for the release.
4. Proofread the release notes, including looking at the online version to
   [catch any broken links](/pt-br/4.0/internals/contributing/writing-documentation/#documentation-link-check) or reST errors, and
   make sure the release notes contain the correct date.
5. Verifique duas vezes as menções de depreciação ao longo do tempo nas notas da release em busca de quaisquer APIs listadas como depreciadas, e que as notas mencionam quaisquer mudanças na versão suportada do Python.
6. Verifique duas vezes se o índice das notas de release possuem um link para as notas da nova release; isso estará em `docs/releases/index.txt`.
7. Se essa é uma feature release, garanta que as traduções do Transifex foram integradas. Isso é tipicamente realizado por um gerente de tradução separado ao invés do releaser, mas aqui vão os passos. Supondo que você tenha uma conta no Transifex:

   ```console
   $ python scripts/manage_translations.py fetch
   ```

   e então faça commit da mudança/arquivos adicionados (.po e .mo). Algumas vezes existem validações de errros que precisam ser depurados, então evite fazer essa tarefa imediatamente antes de uma release ser necessária.
8. [Atualize a página de manual do django-admin](/pt-br/4.0/internals/contributing/writing-documentation/#django-admin-manpage):

   ```console
   $ cd docs
   $ make man
   $ man _build/man/django-admin.1  # do a quick sanity check
   $ cp _build/man/django-admin.1 man/django-admin.1
   ```

   e então faça commit da página man alterada.
9. If this is the alpha release of a new series, create a new stable branch
   from main. For example, when releasing Django 3.1:

   ```console
   $ git checkout -b stable/3.1.x origin/main
   $ git push origin -u stable/3.1.x:stable/3.1.x
   ```

   At the same time, update the `django_next_version` variable in
   `docs/conf.py` on the stable release branch to point to the new
   development version. For example, when creating `stable/4.2.x`, set
   `django_next_version` to `'5.0'` on the new branch.
10. If this is the “dot zero” release of a new series, create a new branch from
    the current stable branch in the [django-docs-translations](https://github.com/django/django-docs-translations) repository. For
    example, when releasing Django 2.2:

    ```console
    $ git checkout -b stable/2.2.x origin/stable/2.1.x
    $ git push origin stable/2.2.x:stable/2.2.x
    ```

## Preparando para a release

Escreva o post no blog para o anúncio da release. Você pode entrar dentro do admin a qualquer momento e marcar ele como inativo. Aqui vão alguns exemplos: , , .

## Lançando a release

OK, esta é a parte divertida, quando nós efetivamente fazemos o push da release!

1. Veja se o status do  é verde para a versão (ou versões) que você está soltando. Você provavelmente não deve lançar uma release enquanto ele não estiver com o status verde.
2. Uma release sempre começa de uma branch de release, então você terá que se certificar que você está em uma branch estável e atualizada. Por exemplo:

   ```console
   $ git checkout stable/1.5.x
   $ git pull
   ```
3. If this is a security release, merge the appropriate patches from
   `django-security`. Rebase these patches as necessary to make each one a
   plain commit on the release branch rather than a merge commit. To ensure
   this, merge them with the `--ff-only` flag; for example:

   ```console
   $ git checkout stable/1.5.x
   $ git merge --ff-only security/1.5.x
   ```

   (This assumes `security/1.5.x` is a branch in the `django-security` repo
   containing the necessary security patches for the next release in the 1.5
   series.)

   If git refuses to merge with `--ff-only`, switch to the security-patch
   branch and rebase it on the branch you are about to merge it into (`git
   checkout security/1.5.x; git rebase stable/1.5.x`) and then switch back and
   do the merge. Make sure the commit message for each security fix explains
   that the commit is a security fix and that an announcement will follow
   ([example security commit](https://github.com/django/django/commit/bf39978a53f117ca02e9a0c78b76664a41a54745)).
4. Para uma feature release, remova o cabeçalho `UNDER DEVELOPMENT` no topo das notas da release e adicione a data da release na próxima linha. Para uma patch release, troque `*Under Development*`, com a data da release. Faça essa mudança em todas as branches em que as notas de release para uma versão em particular estiverem localizadas.
5. Atualize o número da versão em `django/__init__.py` para a release. Por favor veja [as notas sobre configurando a tupla VERSION](#notes-on-setting-the-version-tuple) abaixo para mais detalhes sobre `VERSION`.
6. If this is a pre-release package, update the “Development Status” trove
   classifier in `setup.cfg` to reflect this. Otherwise, make sure the
   classifier is set to `Development Status :: 5 - Production/Stable`.
7. Faça uma tag da release usando `git tag`. Por exemplo:

   ```console
   $ git tag --sign --message="Tag 1.5.1" 1.5.1
   ```

   Você pode checar o seu trabalho rodando o comando `git tag --verify <tag>`.
8. Faça o push do seu trabalho, incluindo a tag: `git push --tags`.
9. Certifique-se de que você tem uma árvore absolutamente limpa rodando o comando git clean -dfx\`.
10. Rodar `make -f extras/Makefile` para gerar os pacotes da release. Isso criará os pacotes da release no diretório `dist/`;
11. Gere os hashes dos pacotes da release:

    ```console
    $ cd dist
    $ md5sum *
    $ sha1sum *
    $ sha256sum *
    ```
12. Create a “checksums” file, `Django-<<VERSION>>.checksum.txt` containing
    the hashes and release information. Start with this template and insert the
    correct version, date, GPG key ID (from
    `gpg --list-keys --keyid-format LONG`), release manager’s GitHub username,
    release URL, and checksums:

    ```text
    This file contains MD5, SHA1, and SHA256 checksums for the source-code
    tarball and wheel files of Django <<VERSION>>, released <<DATE>>.

    To use this file, you will need a working install of PGP or other
    compatible public-key encryption software. You will also need to have
    the Django release manager's public key in your keyring. This key has
    the ID ``XXXXXXXXXXXXXXXX`` and can be imported from the MIT
    keyserver, for example, if using the open-source GNU Privacy Guard
    implementation of PGP:

        gpg --keyserver pgp.mit.edu --recv-key XXXXXXXXXXXXXXXX

    or via the GitHub API:

        curl https://github.com/<<RELEASE MANAGER GITHUB USERNAME>>.gpg | gpg --import -

    Once the key is imported, verify this file:

        gpg --verify <<THIS FILENAME>>

    Once you have verified this file, you can use normal MD5, SHA1, or SHA256
    checksumming applications to generate the checksums of the Django
    package and compare them to the checksums listed below.

    Release packages:
    =================

    https://www.djangoproject.com/m/releases/<<RELEASE TAR.GZ FILENAME>>
    https://www.djangoproject.com/m/releases/<<RELEASE WHL FILENAME>>

    MD5 checksums:
    ==============

    <<MD5SUM>>  <<RELEASE TAR.GZ FILENAME>>
    <<MD5SUM>>  <<RELEASE WHL FILENAME>>

    SHA1 checksums:
    ===============

    <<SHA1SUM>>  <<RELEASE TAR.GZ FILENAME>>
    <<SHA1SUM>>  <<RELEASE WHL FILENAME>>

    SHA256 checksums:
    =================

    <<SHA256SUM>>  <<RELEASE TAR.GZ FILENAME>>
    <<SHA256SUM>>  <<RELEASE WHL FILENAME>>
    ```
13. Assine o arquivo de checksum (`gpg --clearsign --digest-algo SHA256 Django-<version>.checksum.txt`). Isso gera um documento assinado, `Django-<version>.checksum.txt.asc` que você pode então verificar usando `gpg --verify Django-<version>.checksum.txt.asc`.

Se você estiver lançando múltiplas releases, repita esses passos para cada release.

## Fazendo a release (ou as releases) disponível ao público

Agora você está pronto para lançar a release efetivamente. Para isso faça:

1. Faça upload do pacote (ou pacotes) da release para o servidor do djangoproject, trocando A.B. com o número de versão apropriado, ex. 1.5 para a release 1.5.x:

   ```console
   $ scp Django-* djangoproject.com:/home/www/www/media/releases/A.B
   ```

   If this is the alpha release of a new series, you will need to create the
   directory A.B.
2. Atualize o(s) arquivo(s)  de checksum:

   ```console
   $ scp Django-A.B.C.checksum.txt.asc djangoproject.com:/home/www/www/media/pgp/Django-A.B.C.checksum.txt
   ```
3. Test that the release packages install correctly using `easy_install`
   and `pip`. Here’s one method:

   ```console
   $ RELEASE_VERSION='1.7.2'
   $ MAJOR_VERSION=`echo $RELEASE_VERSION| cut -c 1-3`

   $ python -m venv django-easy-install
   $ . django-easy-install/bin/activate
   $ easy_install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION.tar.gz
   $ deactivate
   $ python -m venv django-pip
   $ . django-pip/bin/activate
   $ python -m pip install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION.tar.gz
   $ deactivate
   $ python -m venv django-pip-wheel
   $ . django-pip-wheel/bin/activate
   $ python -m pip install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION-py3-none-any.whl
   $ deactivate
   ```

   Isso só verifica se as tarballs estão disponíveis (ex. redirecionamentos estão funcionando) e que eles instalaram corretamente, mas eles irão pegar erros bobos.
4. Ask a few people on IRC to verify the checksums by visiting the checksums
   file (e.g. <https://media.djangoproject.com/pgp/Django-1.5b1.checksum.txt>)
   and following the instructions in it. For bonus points, they can also unpack
   the downloaded release tarball and verify that its contents appear to be
   correct (proper version numbers, no stray `.pyc` or other undesirable
   files).
5. Faça o upload dos pacotes da release para o PyPI (para pre-release, somente atualize o arquivo wheel):

   ```console
   $ twine upload -s dist/*
   ```
6. Vá para \` a página Add release no admin\`\_\_, entre com o número da nova release exatamente como ele aparece no nome da tarball (Django-\<version\>.tar.gz). Então entre com “1.5.1” ou “1.4c2”, etc. Se a release é parte de uma branch LTS, marque ele como tal.

   If this is the alpha release of a new series, also create a Release object
   for the *final* release, ensuring that the *Release date* field is blank,
   thus marking it as *unreleased*. For example, when creating the Release
   object for `3.1a1`, also create `3.1` with the Release date field blank.
7. Faça um post no blog anunciando que a release foi lançada.
8. Para uma nova versão de release (ex. 1.5, 1.6), atualize a versão estável padrão da documentação alterando a flag `is_default`  para `True` no objeto `DocumentRelease` apropriado no banco de dados de `docs.djangoproject.com` (isso irá alterar automaticamente ela para `False` para todos os outros); você pode fazer isso usando o site do admin.

   Create new `DocumentRelease` objects for each language that has an entry
   for the previous release. Update djangoproject.com’s
   file by copying entries from `manage_translations.py robots_txt` from the
   current stable branch in the `django-docs-translations` repository. For
   example, when releasing Django 2.2:

   ```console
   $ git checkout stable/2.2.x
   $ git pull
   $ python manage_translations.py robots_txt
   ```
9. Post the release announcement to the [django-announce](/pt-br/4.0/internals/mailing-lists/#django-announce-mailing-list), [django-developers](/pt-br/4.0/internals/mailing-lists/#django-developers-mailing-list),
   and [django-users](/pt-br/4.0/internals/mailing-lists/#django-users-mailing-list) mailing lists. This should include a link to the
   announcement blog post.
10. If this is a security release, send a separate email to
    [oss-security@lists.openwall.com](mailto:oss-security@lists.openwall.com). Provide a descriptive subject, for example,
    “Django” plus the issue title from the release notes (including CVE ID). The
    message body should include the vulnerability details, for example, the
    announcement blog post text. Include a link to the announcement blog post.
11. Add a link to the blog post in the topic of the `#django` IRC channel:
    `/msg chanserv TOPIC #django new topic goes here`.

## Pós-release

Você quase terminou! Tudo que resta a fazer agora é:

1. Atualizar a tupla `VERSION` em `django/__init__.py` novamente, incrementando ela para qualquer que seja a próxima release. Por exemplo, depois de soltar a release 1.5.1, atualize `VERSION` para `VERSION = (1, 5, 2, 'alpha', 0)`.
2. Add the release in [Trac’s versions list](https://code.djangoproject.com/admin/ticket/versions) if necessary (and make it the
   default by changing the `default_version` setting in the
   code.djangoproject.com’s , if it’s a final release). The new X.Y
   version should be added after the alpha release and the default version
   should be updated after “dot zero” release.
3. Se essa for uma release de segurança, atualize [Archive of security issues](/pt-br/4.0/releases/security/) com detalhes dos problemas endereçados.

## Tarefas para novas branches estáveis

Existem várias coisas para fazer no momento posterior a criação de uma nova branch estável (geralmente após uma alpha release). Algumas dessas tarefas não precisam ser feitas pelo releaser.

1. Crie um novo objeto `DocumentRelease` no banco de dados de `docs.djangoproject.com` para a nova versão da documentação, e atualize o JSON fixture `docs/fixtures/doc_releases.json`, para que pessoas sem acesso ao DB de produção possam ainda rodar uma cópia atualizada do site da documentação.
2. Criar um esboço de uma nota de release para a nova versão. Use o esboço de versões de releases anteriores ou copie os conteúdos de versões prévias e exclua a maior parte do conteúdo deixando apenas os cabeçalhos.
3. Aumente as iterações PBKDF2 padrão em `django.contrib.auth.hashers.PBKDF2PasswordHasher` por cerca de 20% (escolha um número redondo). Rode os testes, e atualize os 3 testes falhos de hashers com os novos valores. Certifique-se de que isso seja registrado nas notas de release (veja as notas da release 1.8 para um exemplo).
4. Remova as funcionalidades que chegaram ao fim de seu clico de depreciação. Cada remoção deve ser feita em um commit separado para claridade. Na mensagem de commit, adiciona um “refs #XXXX” para o ticket original onde a depreciação começou se possível.
5. Remova as anotações `.. versionadded::`, `.. versionadded::`, e `.. deprecated::`  na documentação das duas releases anteriores. Por exemplo, no Django 1.9, notas para a 1.7 serão removidas.
6. Add the new branch to [Read the Docs](https://readthedocs.org/projects/django/). Since the automatically
   generated version names (“stable-A.B.x”) differ from the version names
   used in Read the Docs (“A.B.x”), [create a ticket](https://github.com/readthedocs/readthedocs.org/issues/5537) requesting
   the new version.
7. [Request the new classifier on PyPI](https://github.com/pypa/trove-classifiers/issues/29). For example
   `Framework :: Django :: 3.1`.

## Considerações quanto a configuração da tupla VERSION

O reporte de versões do Django é controlado por uma tupla `VERSION` em `django/__init__.py`. Essa é uma tupla de cinco elementos, cujos elementos são:

1. Versão principal.
2. Versão secundária.
3. Micro versão.
4. Status – pode ser “alpha”, “beta”, “rc” ou “final”.
5. Número das séries, para alpha/beta/RC packages que rodam em sequência (permitindo, por exemplo, “beta 1”, “beta 2”, etc.).

Para uma release final, o status é sempre “final” e o número das séries é sempre 0. Um número de séries 0 com um status “alpha” será reportado como “pre-alpha”.

Alguns exemplos:

- `(1, 2, 1, 'final', 0)` → “1.2.1”
- `(1, 3, 0, 'alpha', 0)` → “1.3 pre-alpha”
- `(1, 3, 0, 'beta', 2)` → “1.3 beta 2”
