# Tasty Installation

## Introduction

These docs cover UNIX installation. Tasty has reportedly been made to run on windows, but the author has no way to test that so you're on your own there.

The basic steps for installing Tasty are to get the code and the requirements, make sure the requirements are installed in your environment, set up a database, configure Tasty to use the database, and then start the Tasty server.

## Download Tasty

Either download the source distribution from the Cheeseshop.

Or check a release from subversion:

    % svn co https://svn.sourceforge.net/svnroot/microapps/tasty/tags/1.1 tasty

## Install Requirements Into Your environment

First, you'll need a database (preferably postgresql; that's what the rest of this document will use as an example. it should work with just about any database that SQLObject supports though). Having sqlite3 installed will also be useful for running the unit tests.

Then you'll need to install setuptools/easy_install (if you don't already have it installed).

Tasty is a pretty standard TurboGears application so if you're comfortable installing and deploying TG, It should be pretty straightforward. Tasty's requirements are all listed in the requirements.txt file and should all be ready to easy_install.

The easiest path to installation (and the strongly recommended approach) is to use the workingenv.py script in the project directory to download and install all of the python dependencies for you:

    % python workingenv.py -r requirements.txt working-env

That will create a 'working-env' directory with all of the requirements installed in it. You must then activate the environment to run tasty:

    % source working-env/bin/activate

You can read more about workingenv.py in Ian Bicking's blog post.

You should then run the unit tests to make sure everything was installed properly. It should look something like:

    % nosetests
    ............................
    ----------------------------------------------------------------------
    Ran 28 tests in 2.876s
    OK

## Create Database and Configure

To set up the database (again, using PostgreSQL as the example), you'll need to create a database user and a new database:

    # for PostgreSQL:
    % createuser tasty
    % createdb tasty

If you change either of those, you'll want to change the entries in dev.cfg and/or prod.cfg

TurboGears can then set up the database tables with:

    % tg-admin sql create

If you're upgrading from a previous release of Tasty, you can just use your existing database. Just check the config files and make sure they have the right settings.

## Run the Tasty Server

It should be ready to run:

    % python start-tasty.py
    # or, for a production setup (no auto-reloading, etc)
    % python start-tasty.py prod.cfg

## Deployment

The recommended approach to deployment is to run Tasty as a standalone server behind an Apache (or lighttpd or nginx or ...) proxy. This article covers how to set up a good production deployment of a TurboGears application and it's instructions should work fine for Tasty.

Tasty can also be deployed as a mod_python application using mpcp. There is a mp_setup() function defined in start-tasty.py. This is a trickier deployment to set up though and is no longer recommended.