---
canonical: "https://www.jsolly.com/blog/upgrading-to-the-latest-3x-django/"
title: "Upgrading to the Latest Django 3.x"
description: "As a prerequisite to an upgrade to Django 4.0, I walk you through my upgrade process to the latest 3.x version"
author: "John Solly"
published: "2022-05-04T12:31:30.000Z"
updated: "2024-11-06T13:34:04.584Z"
---

<a id="upgrading-to-the-latest-django-3x"></a>

# Upgrading to the Latest Django 3.x

![The text 'upgrade' with lots of arrows pointing upward](https://d1d7p8ufhgz4ld.cloudfront.net/media/post_metaimgs/upgrade.png)

Django puts out a [fantastic doc](https://docs.djangoproject.com/en/4.0/howto/upgrade-version/) on upgrading to the latest version. I am using Django 3.2.7 and the latest is  3.2.13. I follow a process instead of blindly upgrading to [upgrade from Bootstrap 4 to 5](https://www.jsolly.com/blog/migrating-bs4-to-bs5/).

<a id="review-release-notes"></a>

## Review Release Notes

I read the release notes for versions between my current version and the latest. For me that’s 3.2.8->3.2.9->3.2.10->3.2.11>3.2.12>3.2.13. I see nothing stand out that would break my app. I’m fortunate this is not a large version jump (like 3.x to 4.x) which comes with depreciations and breaking changes. There's currently [an open issue](https://github.com/jsolly/awesome-django-blog/issues/37) to do this major version upgrade on blogthedata.com

<a id="resolve-depreciation-warnings-and-run-unit-tests"></a>

## Resolve depreciation warnings and run unit tests

According to the docs:

> Before upgrading, it’s a good idea to resolve any deprecation warnings raised by your project while using your current version of Django. Fixing these warnings before upgrading ensures that you’re informed about areas of the code that need altering.
> 
> In Python, deprecation warnings are silenced by default. You must turn them on using the `-Wa` Python command line option or the [`PYTHONWARNINGS`](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONWARNINGS "(in Python v3.10)") environment variable. For example, to show warnings while running tests:

When I ran the tests, everything looked wonderful except for depreciation warnings within the django-admin-honeypot module. I don’t worry because the error targets Django 4.0, not 3.x

<pre><code class="language-python">/code/blogthedata/django_project/venv/lib/python3.9/site-packages/admin_honeypot/admin.py:31: RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is deprecated in favor of django.utils.translation.gettext_lazy().
  get_path.short_description = _('URL')</code></pre>

A quick note on Python dependencies...there's a chance some Python modules will break in the latest Django version that won't show up in the depreciation warnings. Unfortunately, I don’t know how to test dependencies premetively. According to this [SO thread](https://stackoverflow.com/questions/43828874/how-to-update-packages-after-upgrading-django), you basically upgrade and see what happens with the stack traces.

<a id="backup-dependencies"></a>

## Backup Dependencies

The app running on my local machine in a virtualenv. To take a snapshot of dependencies, I run pip freeze to save them to a requirements.txt file. This file can be used to re-create the virtualenv if things go sideways.

`pip freeze > requirements_5_4_22.txt`

<a id="perform-the-upgrade-in-the-dev-environment"></a>

## Perform the Upgrade in the Dev Environment

`pip install Django==3.2.13`

I re-ran my unit tests and everything passed!

<a id="perform-the-upgrade-in-prod"></a>

## Perform the Upgrade in Prod

First I [commit the requirements file](https://github.com/jsolly/awesome-django-blog/commit/c26af01cd34563e508e465f5e8cdc3462b3345bc) to source control. Then I use it to upgrade Django in production.

Everything went smoothly! Prod is now on the latest 3.x Django version!

May 4, 2022 in [Web Dev](https://www.jsolly.com/blog/category/web-dev/)

Updated November 6, 2024
