building a web interface

Alice Bevan–McGregor alice at
Thu Nov 25 09:36:49 CET 2010


I'm mildly biased, being the author of the framework, but I can highly 
recommend WebCore for rapid prototyping of web applications; it has 
templating via numerous template engines, excellent JSON (AJAJ) 
support, and support for database back-ends via SQLAlchemy.  It also 
has session support baked-in via a project called Beaker.  
Documentation is fairly complete, and I can be found camping in the 
#webcore IRC channel on at strange hours.

If you can write a class, you can have a fully operational web 
application in a single file of ~8 lines or so.  (Or you can create a 
complete easy-installable Python package with multiple modules.)

For information, see:

As an interactive-fiction example:

class RootController(web.core.Controller):
    def index(self):
        """This returns a template that uses JavaScript to call execute().
        The JavaScript adds the result of execute() to the display."""
        session = db.Session().save()
        return './templates/main.html', dict(

    def execute(self, session, statement):
        """Load our session and pass the input off to our interactive
        fiction library of choice.  Return the result if all went well."""
        session = db.Session.get(session)

            result = myiflib.execute(session, statement)

        except myiflib.ParseError:
            return 'json:', dict(status="failure", message="Error...")

        return 'json:', dict(status="success", message=result)

 — Alice.

More information about the Python-list mailing list