Python + Heroku for dummies: run a ‘parasitic’ code on a new Heroku “get started” project in 5 quick steps

disclaimer: the following assumes you are running a decent Linux distribution and you already have python and git installed. It also assumes you start off a fresh Heroku account.

enjoy, and play safe.

go into your desired project home directory

this dir will contain the entire “get started” project from Heroku which we will later use as a host for our Python code.

cd ~/gitProjects/

 

install the infrastructure

these tools are a prerequisite of Heroku. I gathered all the different commands from the different install sites for you, just run them one after the other:

 wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
sudo easy_install pip
sudo apt-get install ruby-full

 

#this next line is for the UBUNTU toolbelt(!) make sure to use the one most suitable for you  
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
sudo pip install virtualenv

 

pull the “getting started” (unwilling host) project from Heroku

 heroku login
 git clone https://github.com/heroku/python-getting-started.git

 

“enhance” the code you “got”

cd python-getting-started

This is the stage we were looking forward to: adding our superior code instead of the worthless one we got from Heruko

First we’ll look for the relevant places that need editing:

grep -i "hello" ./* -r

grep

This gives us a good place to start.

Basically, it says we need to change the entire “hello” dir (big surprise there), and swap it with our own project dir. The rest is just linkage.

Make sure you put you don’t leave any loose ends that may cause trouble in the future, and clean all that unneeded existing references to the old code.

 

send your ABOMINATION to the Heroku cloud

heroku create
git push heroku master

set the scale of the app to be 1 dyno (you can always change it later)

heroku ps:scale web=1

and go to the project URL

heroku open

 

Adam Lev-Libfeld

A long distance runner, a software architect, an HPC nerd (order may change).

Latest posts by Adam Lev-Libfeld (see all)

Python + Heroku for dummies: run a ‘parasitic’ code on a new Heroku “get started” project in 5 quick steps

Leave a Reply

Your email address will not be published. Required fields are marked *