Winston Wolff wrote:
Hello Ian-

I am starting to look at your WSGI port of Webware, and I am hoping you can give me some idea of where to start. What do I need to do to run it? Are you using it with Apache or with a stand-alone web server?

So far I've used it only with CGI, but it should be usable with other WSGI servers. Peter Hunt added some files to svn://colorstudy.com/trunk/WSGI/phunt , one of which is a Twisted server. There's also FastCGI servers and other stuff out there, some noted here: http://blog.colorstudy.com/ianb/weblog/2004/10/13.html#P163


I see there are some example files like Hello.py. How can I run those and see that it works?

I added a README.txt which hopefully will make it easier. I've copied the contents below:


WSGI WebKit
===========

This is a port of Webware's__ WebKit interface to Python's Web Server
Gateway Interface (WSGI_).

.. __: http://webwareforpython.org
.. _WSGI: http://www.python.org/peps/pep-0333.html

Installation
------------

The parent directory (``WSGI/``) should be in your ``PYTHONPATH``.
Also, ``Webware/`` should be in your path -- some components of
Webware are being imported (e.g., from MiscUtils).

The function ``wkserver.webkit(directory)`` is used to build a WSGI
application.  An "application" in WSGI is anything that produces
content, while a "server" is something that consumes that content and
transmits it towards the user.

Some components are both server and client, these are called
"middleware".  WSGI WebKit uses several of these; ``wkserver.webkit``
nests these middleware appropriately.  Ultimately, your servlets will
also be applications.

Setting up your application
---------------------------

For many applications, the only thing you should need to do is change
your import ``from WebKit.Page import Page`` to ``from
WSGIWebKit.wkservlet import Page``.  ``wkservlet`` also contains an
implementation of ``HTTPServlet``.

Using the files here, the minimal way is to then create a CGI script::

    #!/usr/bin/env python
    import sys
    sys.path.extend(['/path/to/WSGI', '/path/to/Webware'])

    from WSGIWebKit import wkserver
    from cgiserver import run_with_cgi

    application = wkserver.webkit('/path/to/my/application/')
    run_with_cgi(application)

The ``application`` object could also be used with other servers,
though I haven't tested it that way yet.

Comparison of architectures
---------------------------

WSGI WebKit's implementation of ``Page`` (and ``HTTPServlet``)
implements a ``__call__`` method, which is all that is required to
make a servlet into a WSGI application.  The __call__ method creates
the transaction (``wktransaction.Transaction``), which in turn creates
the request (``wkrequest.HTTPRequest``) and response
(``wkresponse.HTTPResponse``).  Then there's a bit of back-and-forth

There are also session and application objects, which are largely
dummy objects that provide some of the interface that was previously
implemented by those objects.  In WSGI WebKit these features
(forwarding and sessions) are implemented in middleware.

This is in contrast to normal Webware, where the ``AppServer`` starts
the connection, hands it off to ``Application``, which creates
``Transaction``, ``HTTPRequest``, and ``HTTPResponse``, then finds the
servlet and runs it with those objects.


------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to