Skip to content

Instantly share code, notes, and snippets.

@tr00st
Last active May 19, 2022 14:40
Show Gist options
  • Select an option

  • Save tr00st/190ab4de62f9b23bea69 to your computer and use it in GitHub Desktop.

Select an option

Save tr00st/190ab4de62f9b23bea69 to your computer and use it in GitHub Desktop.

Revisions

  1. tr00st revised this gist May 19, 2022. No changes.
  2. tr00st revised this gist Feb 2, 2015. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions switch_to_python3.4.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,10 @@
    #!/bin/bash
    #
    # Copyright 2015 James Cheese
    # You may do anything with this work that copyright law would normally
    # restrict, so long as you retain the above notice(s) and this license
    # in all redistributed copies and derived works. There is no warranty.
    #
    # Python 3 Upgrade for Django Droplet
    # Will update the "Django on 14.04" Digital Ocean image.
    # Run as root.
  3. tr00st created this gist Feb 2, 2015.
    21 changes: 21 additions & 0 deletions switch_to_python3.4.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #!/bin/bash
    # Python 3 Upgrade for Django Droplet
    # Will update the "Django on 14.04" Digital Ocean image.
    # Run as root.

    # Grab psycopg2 and pip
    apt-get install python3-pip python3-psycopg2

    # Remove the Python 2.7 version of gunicorn, so we can...
    pip uninstall gunicorn

    # Install the Python 3 version of gunicorn, and a couple of dependencies.
    pip3 install gunicorn tornado django
    # Sadly, at time of writing, gevent isn't Python 3 compatible... But tornado is!
    # So, switch them out with a little sed magic
    sed 's/worker_class = '\''gevent'\''/worker_class='\''tornado'\''/' /etc/gunicorn.d/gunicorn.py -i.orig

    # Restart gunicorn to make the changes take effect...
    service gunicorn restart

    # And we're good!