This post shows how to install Turbogears2 (TG2) in a Python virtual environment. (Update: Using Fedora 14)

Install required software:

yum install python-setuptools python-virtualenv

PostgreSQL dependencies (needed by PyGreSQL)

yum install gcc postgresql-devel

For MySQL backend, dependencies:

yum install gcc mysql-devel

Install TG2 in virtual env: (as root)

mkdir -p /usr/local/pythonenv
virtualenv --no-site-packages /usr/local/pythonenv/HelloWorld

Activate virtual env:

source /usr/local/pythonenv/HelloWorld/bin/activate

Install PostgreSQL database components: (in virtualenv, as root)

easy_install PyGreSQL
easy_install psycopg2

Install TG2.1: (in virtualenv, as root)

easy_install -i tg.devtools
easy_install -i Genshi
easy_install tw.jquery

Start developing TG2 app:

Note: Another way to add dependencies – edit, add package name to ‘install_requires’ variable. For MySQL, add ‘MySQL-python’

Activate virtualenv first (as regular user – ‘webmaster’)

source /usr/local/pythonenv/HelloWorld/bin/activate

Create TG2 app:

paster quickstart HelloWorld

Install required packages for this new app: (in virtual env, as root)

cd HelloWorld/
python develop

Make sure to use new PostgreSQL DSN format: (development.ini)

postgresql://username:[email protected]:port/databasename

Populate database (as regular user, refer HelloWorld/helloworld/

paster setup-app development.ini

Launch TG standalone server

paster serve --reload development.ini

… and start coding / debugging at http://localhost:8080

To change default URL address: (development.ini)

host =
port = 5000

Turbo + Gear