Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upgrade django?

Tags:

python

django

My project was running on Django 1.5.4 and I wanted to upgrade it. I did pip install -U -I django and now pip freeze shows Django 1.6.5 (clearly django has upgraded, I'm in virtualenv) but my project is still using Django 1.5.4. How can I use the upgraded version?

UPDATE: Thanks for your comments. I tried everything but unfortunately nothing worked and I had to re-deploy the app.

Hope someone explains why this happened.

like image 958
user3030969 Avatar asked May 17 '14 07:05

user3030969


People also ask

Should I update Django?

It is a good idea to keep up with the latest Django version even if it is not a LTS release. You get the latest security enhancements, features, and performance improvements. You also reduce technical debt of upgrading down the road when you are multiple versions behind.

How do I install different versions of Django?

If you want to install a specific Django version, then you use the exact same command but you add something at the end, which is you define the version that you want to use, so a double equal sign ( == ) and then a version number is going to make pip install that specific version of Django.


5 Answers

You can use --upgrade with the pip command to upgrade Python packages.

pip install --upgrade django==3.3.1
like image 184
Yogesh dwivedi Geitpl Avatar answered Oct 19 '22 19:10

Yogesh dwivedi Geitpl


I use this command for upgrading any package using pip:

pip install <package-name> --upgrade 

Example: pip install django --upgrade

you need to use the --upgrade or -U flag for upgrading.

Alternatively, you can use python -m pip install -U Django.

like image 42
ruddra Avatar answered Oct 19 '22 19:10

ruddra


  1. Use this command to get all available Django versions: yolk -V django
  2. Type pip install -U Django for latest version, or if you want to specify version then use pip install --upgrade django==1.6.5

NOTE: Make sure you test locally with the updated version of Django before updating production.

like image 13
GrvTyagi Avatar answered Oct 19 '22 19:10

GrvTyagi


You can use pip install -U django. It will update to the current stable version. Read official documentation on Django Docs

like image 8
Sam Vyatkin Avatar answered Oct 19 '22 17:10

Sam Vyatkin


with python 3.7 try:

sudo pip3 install --upgrade django==2.2.6

Because using the following:

pip3 install -U django

or with python 2.7 if you like to keep that old python:

pip install -U django

Only gives you the older version of django (1.11.xx instead of 2.2.6)

like image 5
ErwanKRUG Avatar answered Oct 19 '22 18:10

ErwanKRUG