[Baypiggies] Python Frameworks

Nick Stinemates nick at stinemates.org
Thu Oct 29 16:48:43 CET 2009

Sounds cool. Where can I get it (and some examples?)

I haven't got out of the boilerplate stages with django yet to get in to
the fun stuff. I'd love to give this a try.

Nick Stinemates

On Tue, Oct 27, 2009 at 09:44:27PM -0700, Keith Dart wrote:
> === On Tue, 10/27, Jeremy Fishman wrote: ===
> > Sorry if I left anyone's favorite project out,
> ===
> Hey, I'll take this opportunity to plug one I'm writing. 
> The pycopia.WWW.framework has the following differentiating features:
> Lightweight
> Clean URL scheme
> URL mappings in one place.
> Leverage "web 2.0"- AJAX/JSON
> Reversible URLs (map handler to URL)
> Privilege separation
> No threads, SMP scalable
> No templates
> Highly modular
> Quick and easy to write and deploy
> Database agnostic
> The reason I am doing this is the following. I wanted a framework that
> could be used to put a "web interface" on an small-scale PC or PC based
> network appliance-type device. Most of those other frameworks tend
> toward being database interfaces, run in one process with threads, and
> can't interface to the system very well. 
> The Pycopia web framework is designed as a collection of smaller
> servers, each one may run with different user credentials and use the
> FCGI protocol to communicate to the front-end, which is a single
> lighttpd server. These are mapped to a single, clean URL tree and is
> transparent to the client. This is done to separate privileges to only
> those parts of the web application that need it. For example, to edit a
> database a back-end FCGI server runs as a pseudo-user that has
> privileges to access the database, and only that. Another back-end
> might need to control a particular device node and therefore needs
> another user and/or group credentials. Another part may need to run a
> program as the logged in user. Since the web server itself does not run
> as that user some part needs to run as root and than perform the
> equivalent of the login program to spawn a subprocess with the user
> account. 
> Since the URL path tree is farmed out to different handler processes
> the whole system can benefit more from SMP systems.
> The URL scheme uses regular expressions to map a URL to a handler.
> The handler may take parameters. This works a lot like Django. However,
> you can also do the reverse by calling the get_url() method with the
> target object (plus optional parameters) and will return the URL that
> will reach it exactly that way. Therefore you don't have to hard-code
> paths in the code which makes re-arranging your tree and handlers
> easier. 
> I don't like templates. I prefer to work purely with Python code.
> Therefore there is an XHTML markup generator system that looks a lot
> like some GUI frameworks (e.g. Tk), but constructs XHTML documents
> instead. 
> However, the use of server-side generated XHTML markup is discouraged.
> Instead, only the first App page is generated. Most of the rest of the
> App is implemented in Javascript and uses the Mochikit framework there.
> The Pycopia framework provides a data interface using JSON
> serialization and a Proxy object that transparently calls server-side
> Python handlers from Javascript functions. The handlers on the server
> side take basic Python objects as parameters and return Python objects.
> These appear as equivalent objects in Javascript. In other words, you
> write Javascript that calls a method on a proxy object with ends up
> going to the server, handled there and returns a value that the
> Javascript then gets as a Javascript object back. Any DOM manipulation
> is done by the Javascript. 
> There is no mandated Database or ORM. I use Sqlalchemy for that when I
> need to access a database. There is a generic forms builder for that.
> There is also a database JSON API handled by an instance of the above
> mentioned proxy object.
> The framework also inherently handles host-based virtual servers. You
> can serve many host/domains from the single server, and each domain may
> run a separate set of back-end handlers. 
> There are several different handler patterns that may be used. Supports
> any callable object. Bare functions, or a subclass of a special handler
> class can be used. The handler subclass just defines get() and post()
> methods to handle forms. 
> I eat my own dogfood. There's not much content, by my websites use this
> framework. All of www.pycopia.org, www.pycopia.net, www.dartworks.biz,
> and www.kdart.com (and more) are run from one instance of this
> framework.
> Thanks for listening. Give a whirl if you're interested. 
> -- Keith Dart
> -- 
> -- --------------------
> Keith Dart
> <keith at dartworks.biz>
> =======================
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies

More information about the Baypiggies mailing list