# Upgrade Django v4.0.x

## Release Highlights
- Django's [default timezone implementation](https://docs.djangoproject.com/en/dev/releases/4.0/#zoneinfo-default-timezone-implementation) is now `zoneinfo` from the Python [standard library](https://docs.python.org/3/library/zoneinfo.html#module-zoneinfo) (as of Python 3.9).
    - Support for `pytz` and use of pytz time zones is [now deprecated](https://docs.djangoproject.com/en/4.0/releases/4.0/#use-of-pytz-time-zones) and will be removed in Django 5.0.
- Forms, Formsets and ErrorList are now rendered using the [template engine](https://docs.djangoproject.com/en/dev/releases/4.0/#template-based-form-rendering)
- There's now [built-in support](https://docs.djangoproject.com/en/dev/releases/4.0/#redis-cache-backend) for Redis caching via [redis-py](https://pypi.org/project/redis/) 3.0.0 or higher.

## Upgrade Gotchas
- Official support for Python 3.6 and 3.7 has been dropped. Officially supported Python versions are now 3.8, 3.9, and 3.10.
    - If you're coming from Django 3.2 (which supported Python 3.6-3.10), note that `zoneinfo` (see above) is only in the Python standard library as of Python 3.9. So you'll probably want to upgrade to at least that version of Python if you're going to Django 4.0
    - It's worth repeating/rephrasing: support for `pytz` is now deprecated and will be removed in Django 5.0. You can still use `pytz` in Django 4.0 if you want, or, you can go the Python 3.9/`zoneinfo` route now and avoid future upgrade hassles in Django 5.0
- Dropped support for PostgreSQL 9.6 and Oracle 12.2 and 18c. Django 4.0 supports [PostgreSQL 10.0+](https://docs.djangoproject.com/en/dev/releases/4.0/#dropped-support-for-postgresql-9-6) and [Oracle 19c](https://docs.djangoproject.com/en/dev/releases/4.0/#dropped-support-for-oracle-12-2-and-18c)
    - minimum supported version of `psycopg2` is now 2.8.4, since it's the first release to support Python 3.8
- Multiple features deprecated in Django [3.0](https://docs.djangoproject.com/en/dev/releases/3.0/#deprecated-features-3-0) and [3.1](https://docs.djangoproject.com/en/dev/releases/3.1/#deprecated-features-3-1) have been [removed in 4.0](https://docs.djangoproject.com/en/dev/releases/4.0/#features-removed-in-4-0)

Source: https://upgradedjango.com/4.0/
