A Django Upgrade Guide For Major And Minor Releases


Recently Django has released a LTS version 4.2. This version will be supported by Django till 2026. It make sense to migrate to this version to ensure continuous support. Here is Django releaseroadmap ![Alt text](https://static.djangoproject.com/img/release-roadmap.4cf783b31fbe.png "Django release roadmap") First let us check our current Django version, there are multiple ways to check django version installed on your machine or in virtual environment. ```terminal ubuntu@ubuntu2204LTS:~/Desktop/ecommpedia.com$ django-admin --version 4.1.7 ``` Now let us run upgrade command to change django version to latest LTS. ```terminal ubuntu@ubuntu2204LTS:~/Desktop/ecommpedia.com$ pip3 install --upgrade django==4.2 Collecting django==4.2 Downloading Django-4.2-py3-none-any.whl (8.0 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.0/8.0 MB 3.4 MB/s eta 0:00:00 Requirement already satisfied: sqlparse>=0.3.1 in ./venvecomm/lib/python3.10/site-packages (from django==4.2) (0.4.3) Requirement already satisfied: asgiref<4,>=3.6.0 in ./venvecomm/lib/python3.10/site-packages (from django==4.2) (3.6.0) Installing collected packages: django Attempting uninstall: django Found existing installation: Django 4.1.7 Uninstalling Django-4.1.7: Successfully uninstalled Django-4.1.7 Successfully installed django-4.2 ``` check if version has been updated ```terminal ubuntu@ubuntu2204LTS:~/Desktop/ecommpedia.com$ django-admin --version 4.2 ``` Please see we are specifiying exact version that we want to upgarde to. If you dont specifiy version, it will upgrade to whichver is latest version. Django will keep releasing minor versions such as 4.2.1, 4.2.2 etc. If you want to uprade to whichever be the latest version, run following command ```terminal ubuntu@ubuntu2204LTS:~/Desktop/ecommpedia.com$ pip3 install --upgrade django ```

This post is written by Pravin

Tags : Python Django

Share it :      

Leave a comment

captcha


Tags

Elsewhere

  1. GitHub
Ad below