Installing Flask and hosting a simple Flask app in Heroku PART 1

Install pip or easy_install to install python packages on ubuntu

sudo apt-get install python-pip

FOR easy_install

sudo apt-get install python-setuptools

Install virtualenv

sudo easy_install virtualenv
pip install virtualenv

After installing virtaulenv isuue this command

virtualenv flask

you will get a folder named flask change directory to this folder

cd flask

It contains a complete Python environment ready to be used for this project
Virtual environments can be activated and deactivated, if desired. An activated environment adds the location of its bin folder to the system path, so that for example, when you type python you get the environment’s version and not the system’s one.

Now install flask

flask/bin/pip install flask

Create a Heroku account and Install the Heroku tool belt


and inserting the basic “Hello World” code

import os
from flask import Flask

app = Flask(__name__)

def hello():
    return 'Hello World!'

Test your Flask install by running this webserver:


You should see this in your terminal:
* Running on

Screenshot from 2015-08-07 20:47:11

Now, navigate to localhost:5000 in your browser and make sure you can see “hello world” printed out in the browser window.