Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP

Create a Basic Flask Development Environment

This tutorial walks you through setting up the tools you need to begin developing in Python and Flask. Note: I assume you are on a Unix environment (OSX, Linux, Linux VM on Windows).

What you need

  • Python 2.7.x
  • easy_install and pip
  • Git 1.7/1.8
  • virtualenv
  • Flask
  • Text editor (Sublime, vim, Komodo, gedit)


  1. Check your Python version - python -V
  2. If you already have a 2.7.x version, move on to the next step.
  3. If not, download and install the latest 2.7.x version


  1. Check your Git version - git --version
  2. Download the latest version, if necessary

easy_install and pip

  1. Download setuptools for Python 2.7

    $ curl -o setuptools-0.6c11-py2.7.egg
  2. Install setup tools

    $ sudo sh setuptools-0.6c11-py2.7.egg
  3. Clean up and delete egg

    $ rm setuptools-0.6c11-py2.7.egg
  4. Install pip

    $ sudo easy_install pip


virtualenv is used to create a self-contained development environment.

  1. Install

    $ sudo pip install virtualenv
  2. Setup your local environment

    $ mkdir new_project
    $ cd new_project
    $ virtualenv --no-site-packages flask
  3. Activate virtualenv

    $ cd flask
    $ source bin/activate


  1. Install

    pip install Flask

Version Control

  1. Add a Git repository

    $ git init

Text editor

  1. Download a text editor. I prefer Sublime.

Quick Application

  1. Create a new file named and add the following code:

    from flask import Flask
    app = Flask(__name__)
    def hello_world():
        return 'Hello World!'
    if __name__ == '__main__':

    Save the file to your "flask" directory.

  2. Run the file with your Python interpreter

    $ python
  3. Point your browser at http://localhost:5000 to view the hello world greeting.

Congrats! Flask has taken the main stage. Cheers.



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.