Install application

Change to your service user context.:

$ sudo -iu SERVICE_USER


To install Python applications in a controlled environment, you can use virtualenv. virtualenv is already installed system-wide on VMs.:

$ cd myproject
$ virtualenv --python=python2.7 .
New python executable in myproject/bin/python2.7
Also creating executable in myproject/bin/python
Installing setuptools............done.
Installing pip...............done.


We recommend to ship your application using buildout. To do so, first download Buildout’s

$ wget

Create a buildout.cfg:

parts = django
versions = versions

Django = 1.5.5

recipe = djangorecipe
eggs = psycopg2
settings = production
project = mysite


Use Buildout to install Django.:

$ ./bin/python
$ ./bin/buildout

Setup application

The follwing steps are Django related and may differ depending on your application.

Adjust mysite/

    'default': {
        'ENGINE': 'postgresql',          # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'django',                # Or path to database file if using sqlite3.
        'USER': 'django',                # Not used with sqlite3.
        'PASSWORD': 'YOUR_PG_PASSWORD',  # Not used with sqlite3.
        'HOST': 'localhost',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.

Initialize the database:

$ ./bin/django syncdb

Test the app to start successfully.:

$ ./bin/django runserver 8000