wsgitalk /

Filename Size Date modified Message
49 B
3.2 KB
== Setup ==

1.) Install Python. I used Python 2.5.2. This code probably has some 2.5
specific code, but it might be worth a try under 2.4.

2.) Next, download this file:

Set it to executable and run it. This will bootstrap 'distribute', a library
for installing python packages.

3.) Run these two commands:

    easy_install virtualenv
    easy_install pip

Virtualenv is a library for setting up a virtual Python environment, which will
allow us to install and run packages outside the system-wide installation of
Python. It works by creating a new python executable we use instead of the
system-wide 'python' executable.

Pip is like distribute or setuptools (it install packages) but it's a little
smarter in that it can work with virtualenv to install packages into the
virtual environment we set up.

4.) Create a new, empty directory:

    mkdir wsgitalk

This is where the virtual environment is going to live.

5.) Create the virtual environment:

    cd wsgitalk
    virtualenv .

This sets up a few directories:

    bin/ - holds our new virtualenv python executable
    build/ - temporary directory for building packages
    include/ - symlink to the python source, for building C extensions
    lib/ - holds the installed packages specific to this virtualenv

6.) Install packages:

Now we can use "pip install -E . packagename" to install the packages we need
to run for these examples:

    cd wsgitalk
    pip install -E . WebOb
    pip install -E . Werkzeug
    pip install -E . CherryPy
    pip install -E . Tempita
    pip install -E . ToscaWidgets
    pip install -E . tw.forms
    pip install -E . Genshi
    pip install -E . selector
    pip install -E . barrel

7.) Put the examples in the virtualenv directory:

Extract the examples* directories into the wsgitalk directory. Mine looks like

    $ cd ~/wsgitalk
    $ ls -1

Now you should be all set up!

== Running the examples ==

Run the examples (and read the documentation at the top of each file) in this

    cd wsgitalk

    bin/python examples1-simple/
    bin/python examples1-simple/
    bin/python examples1-simple/
    bin/python examples1-simple/
    bin/python examples1-simple/ werkzeug
    bin/python examples1-simple/ cherrypy

    bin/python examples2-basics/
    bin/python examples2-basics/
    bin/python examples2-basics/
    bin/python examples2-basics/

    bin/python examples3-lifecycle/
    bin/python examples3-lifecycle/

    bin/python examples4-notebrowser/

    bin/python examples5-forms/

    bin/python examples6-auth/

Note you have to run bin/python, that's the python interpreter for the
virtualenv we just set up. You can also run this:

    source bin/activate

This puts the virtualenv 'bin' directory higher up on the path, so you can just
run 'python' instead of 'bin/python'.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.