Let’s Install TurboGears

In order to install TurboGears we need Python setuptools and in order to create an isolated environment we need virtualenv package.  Why an isolated environment? With a virtual environment we don’t need to think about our packages clashing.

Install requirements:

 sudo apt-get install build-essential python-dev python-setuptools python-virtualenv 

Those installation requirements are not specific to TurboGears. If you are working with Python anyway and tried to use any Python package management that means you already have these packages.

The standard installation

$ virtualenv --no-site-packages tg2env 
$ cd tg2env/ 
$ source bin/activate 
(tg2env)$ easy_install -i http://tg.gy/current/index/ tg.devtools 
(tg2env)$ deactivate 

You may get errors depending on your system and your system’s requirements. If you have not seen any errors, congratulations, you have installed TurboGears 2.1.4 (the current stable release as of this writing) and its dependencies successfully.

The pip way

You have tried to install TurboGears with the standard way however you are curious. How to install with pip as well? Fear not, young TGer. I will feed your hunger.

pip install -i http://tg.gy/current tg.devtools

Let’s create an example TurboGears project.

This entry was posted in Python, TurboGears and tagged , , , , , , , . Bookmark the permalink.

13 Responses to Let’s Install TurboGears

  1. Pingback: Introduction to TurboGears | TurboGears Notes

  2. Cedrick Vincent B. Lidasan says:

    I would like to ask if Turbogears is working well with Windows 64bit?
    What is the installation process of Turbogears for 64bit Windows?

    • mengukagan says:

      hi cedric,

      there is no reason for TurboGears not to work with 64-bit windows.

      you need Python on your computer, setuptools package which can be found at http://pypi.python.org/pypi/setuptools#windows and then the rest is same.

      you install virtualenv with easy_install virtualenv and then you are good to go with the same steps as linux or unix.

      do you think a post on installing on windows would help?

      • Cedrick Vincent B. Lidasan says:

        Thanks for your time and help.

        I already install installed Turbogears in my Windows.
        However, I am quite confuse because in the templates folder I have files like about.mak, index.mak, header.mak, master.mak . Are these files supposedly html files?

        I want to access the html files so that i could design the project first.

      • mengukagan says:

        hi Cedrick,

        you have generated a TurboGears project with mako templates. those are supposedly html files which also support python operations and you can access the variables exposed to views.

        please read http://www.turbogears.org/book/part1/wiki20.html for more information.

  3. Cedrick Vincent B. Lidasan says:

    Another question.

    How do you make a login session in Turbogears? Just like a cookie login in php. ? Where in it can save the username info who login in the system? and how do you access it?

  4. Cedrick Vincent B. Lidasan says:

    Another question.

    I can do a little python in my mak files like this..

    % for a,b,c in zip([0,1,2,3,4,5], courselist[0], courseid[0]):
    form1.Courses.options[${a}] =new Option(‘${b}’,’${c}’);
    % endfor

    however, i have a variable i in java script.
    how could i use the variable i in the python loop?

    I need to do like this:

    % for a,b,c in zip([0,1,2,3,4,5], courselist[i], courseid[i]):
    form1.Courses.options[${a}] =new Option(‘${b}’,’${c}’);
    % endfor

    however, it tells an error because i is undefined. I really need to use the value of i in the loop.

  5. mengukagan says:


    When I need to form a JavaScript array in my templates, I use something like this: https://gist.github.com/mengu/4f6fe739014db8fc558b

  6. Cedrick Vincent B. Lidasan says:

    Hi, I have successfully created a working project.
    Thanks for your time and suggestions. 🙂

    Do you have any idea how to make my project working online. How to install Turbogears in a hosting site?

  7. Cedrick Vincent B. Lidasan says:

    Do you know any free hosting sites for Turbogears?

  8. Cedrick Vincent B. Lidasan says:

    How can i access my application/project using another computer? via adhoc?
    If the project is working in laptop1, can laptop2 access the project as well..?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s