Question

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

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!

Subscribe
Share

It would be really nice someone would answer the above question! We need Python 3+ now.

I’d really like to know this as well.

Hey did you figure out how to do this? I just went the 1-click route right now as well and noticed the same thing.

Hey did you figure out how to do this? I just went the 1-click route right now as well and noticed the same thing.

Hey did you figure out how to do this? I just went the 1-click route right now as well and noticed the same thing.

Interesting… It appears to me that DO’s image has both Python 2 and 3 in path. Type Python3 and you get Python3.4.3 from Oct 14, 2015 when building today (Aug 18, 2016). That said, I used some other DO documentation for their one-click-installer according the the instructions you’ve linked above and I cannot even locate it again. Plus, I’m guessing the image/scripts they use have changed since this original post. I cannot even get into the Django instance as appears the install credentials fail, root user credentials fail, the manage.py createsuperuser script fails.

Plus, what about these: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-14-04 https://www.digitalocean.com/community/tutorials/how-to-install-the-django-web-framework-on-ubuntu-14-04

I would love an answer to this question…

Wanting to know aswell. Python 3 is now standard…


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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?

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.

Hi heitorpontual,

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

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.

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.

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!

Hi y’all…I just had this same issue, and though it certainly does away with the efficacy of the one-click thing, I was able to make this work by starting a new django project and then following these steps to make it the ‘real’ one:

https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04

…of course, numerous of these steps are redundant, since the one-click already set up a job, but I followed them all and was able to get my site to point to the new one (which is using Python 3.5, all tucked away in its virtual environment like its supposed to be), without having to remove my droplet!

Sure would be a lot easier if there were a new option to cover this though…

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?

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