dropme
By:
dropme

How to upgrade 1-click installer to Python 3 and newer version of Django?

March 19, 2016 2.6k views
Django Python One-Click Install Apps Deployment Ubuntu

So I am using the 1-click installer for Django, but found out is still using Python 2.7.6 and Django 1.6.1. Instead I want to use Python 3.x, but how do I do that?

I reviewed the article below, but again it focuses on Python 2.x:

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn

The 1-click article about Django had some tiny bit of Python 3 information in the comment, but not enough for me to figure out what to do:

https://www.digitalocean.com/community/tutorials/how-to-use-the-django-one-click-install-image

It is kind of baffling that there seems to be so little information about Python 3.x still and that so far I only found Heroku to have it ready to go. Any help would be much appreciated!

6 comments
3 Answers

Non of the answers above make any sense to me. It would really streamline my development process if there was django + python3 droplet available from start. If anyone figures out how to switch 1-click django installer to Python 3, please post the answer here! I spent days searching for the answer and I'm not getting anywhere...

You can use the alias command to customize this to strictly python3. In your server console:

  1. Type 'python --version'. It will tell you the version of python that responds to the 'python' command.
  2. Type 'python3 --version'. This will be the version you want to use.
  3. Type 'alias python=python3'. This changes the value of the python command to that of python3.
  4. Repeat step 1 to make sure it works.

We also want to make sure that the pip command is synced with the desired python version.

  1. Type 'sudo apt install python3-pip' and install it.
  2. Type 'alias pip=pip3'.
  3. Update pip by typing 'sudo pip install --upgrade pip'

Updating other libraries
NOTE: If you need to update/install packages globally, you will need to use the sudo command.

  1. Type 'pip list' to see what you want to upgrade.
  2. Use 'sudo pip ....' to accomplish what you need!
  • The above response is for virtual environments. Please note that the global library install is incorrect above as it will install a library to python2. See #2 below for correction.

    For the admin level (using sudo), use:

    1. 'sudo python3' instead of 'sudo python'
    2. 'sudo pip3' instead of 'sudo pip'.
Have another answer? Share your knowledge.