wsgitalk /

Filename Size Date modified Message
examples1-simple
examples2-basics
examples3-lifecycle
examples4-notebrowser
examples5-forms
examples6-auth
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:

    http://python-distribute.org/distribute_setup.py

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
this:

    $ cd ~/wsgitalk
    $ ls -1
    bin/
    build/
    examples1-simple/
    examples2-basics/
    examples3-lifecycle/
    examples4-notebrowser/
    examples5-forms/
    examples6-auth/
    include/
    lib/
    readme.txt

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
order:

    cd wsgitalk

    bin/python examples1-simple/simple.py
    bin/python examples1-simple/environ.py
    bin/python examples1-simple/dummy_server.py
    bin/python examples1-simple/servers.py
    bin/python examples1-simple/servers.py werkzeug
    bin/python examples1-simple/servers.py cherrypy

    bin/python examples2-basics/wrapper_werkzeug.py
    bin/python examples2-basics/wrapper_webob.py
    bin/python examples2-basics/middleware.py
    bin/python examples2-basics/framework.py

    bin/python examples3-lifecycle/base_app.py
    bin/python examples3-lifecycle/run_with_lifecycle.py

    bin/python examples4-notebrowser/notebrowser.py

    bin/python examples5-forms/form_app.py

    bin/python examples6-auth/app.py

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 ProjectModifiedEvent.java.
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.