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

Posted March 19, 2016 12.1k views
UbuntuPythonDjangoDigitalOcean 1-Click Apps MarketplaceDeployment

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:

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:

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!


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
11 answers

I came to DigitalOcean for the 1-click install of django as I don’t want to deal with the server admin stuff. If there isn’t a 1-click method, or fairly easy way to upgrade to python 3 and django 2+, I’m out.

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’.
    • I had to destroy my droplet after following these commands cause the actual alias ‘pip’ started giving an import error.
      Plus the question here is mainly how to change the environment of django from Python2 to Python3. Are you saying that we should re-install django on python3?
      If YES than should we also install the n-ginx web server as well for python3?

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…

Also not getting anywhere with the 1 click install. It does all the wrong versions. Best is to build server from scratch until DO allows users to pick their versions. Also trying to change everything to python3 form the 1-click-install python2 always ends messy.

Possibly a dangerous move, but what I did that finally worked was after making sure python3 and pip3 were installed:

Go to /usr/bin, remove python and pip, and create new links

ln -s python3 python

ln -s pip3 pip

Then pip install

  • django==1.11.15
  • gunicorn==19.7.1 important: this must be the exact version
  • gevent
  • netifaces

Finally, restart nginx and gunicorn. Hope I didn’t forget anything.

Hi heitorpontual,

I did according your step but it is showing now 502 Bad Gateway

Yeah. This is a pain in the effin ass. It effectively makes this one-click install useless. C'mon DO. This should be an easy fix. How do I tag DO in this so Steve can spin up a new image?

Following this question as well.
Be awesome for DO to allow user which versions to install for images.

Been trying to figure out how to do this. I’d love to upgrade the 1 click Django install to Django 2. @joelrinkoff does your solution upgrade the server’s software and allow us to work with Django 2 without any other config etc?

Previous 1 2 Next