What technologies should I use for my application manager?

Adam Jones ajones1 at gmail.com
Mon Jun 26 03:30:31 EDT 2006


MrBlueSky wrote:
> Hello!  I've just finished working on my first Python app (a
> Tkinter-based program that displays the content of our application log
> files in graphical format).   It was a great experience that's had a
> very positive response from my colleagues.
>
> So I'd like to try something different for my second Python
> application.  It's a simple server that can launch and monitor the
> state of our program, to help our software developers.  In my mind I
> have a vision of:
> * a web server
> * allows the user to launch our product (choosing from a set of
> different launch scripts)
> * allow user to stop a launched product
> * report state by retrieving data from the RDBMS against which the
> product runs (Oracle or SQL Server)
>
> There seem to be a lot of web server related Python libraries around,
> and I've no experience in web servers at all.   So I'd really
> appreciate some advice on what Python "technologies" you think I should
> base my application on.
>

For speed of development I would suggest looking into a framework that
can do some of the heavy lifting for you. Out of those the "really big
names" in python are Turbogears ( http://www.turbogears.org/ ), Django
( http://www.djangoproject.org/ ), and Zope ( http://www.zope.org ).
(along with others that I have forgotten who shall most likely be
mentioned promptly) Of them all I have the most experience with
Turbogears, so that is what I will try and sell you on.

By default Turbogears provides support for *either* MS SQL or Oracle.
One of the differences between Turbogears and most web frameworks is
that many of the bigger chunks of code for it are taken from existing
projects instead of being written internally. Due to this Turbogears
provides support for two database mappers: Sqlobject, which supports MS
SQL; and Sqlalchemy, which supports Oracle. Of the two Sqlalchemy is
much more flexible, but is also a newer project and may be harder to
work with until the api finishes settling. Both projects offer full
support for one of the databases you mentioned, and developmental
support for the other. If you need to work with both it is possible to
bring in the database integration method of your choice.

Turbogears has a very flexible widget system that supports a lot of
interesting code. Basic things like user input forms can be handled
with widgets, but there are also prebuilt widgets for things like
find-as-you-type form fields, calendar-based date pickers, tabbed
displays, syntax-highlighted text, and a plotting kit (and those are
just the fancy things that looked like they would be useful).

There is a pretty nice validation system that can handle converting
user input into appropriately typed python objects, and can
automatically force a correction page if you would like it to do so.

Like any other framework Turbogears has a templating system to help
handle the html/css/javascript that you will be using. By default it
uses Kid, which is XHTML with an additional namespace that provides
support for looping, element replacement, and limited function
definitions. Overall I have found it to be pretty nice to work with.
That said if you want something else you can install plugins for a few
different templating languages. (Currently supported are Cheetah, Stan,
ZPT, HtmlPy, Clearsilver, Myghty, and Python String Templates)

Obviously some of the more important parts you are looking for are
integration into the system environment, logging, and possibly user
authentication and scheduled tasks. By default Turbogears supports all
of the access to the surrounding system that Python does. This is kind
of a no-brainer, but for me at least was something of a stumbling block
in coming from PHP.

The logging system is based on the built-in logging package for Python.
It is configured through Turbogears to allow some of the components
involved to support it. You have access to pretty much all of the
facilities that the Python logger provides.

User authentication in Turbogears is generally handled through the
Identity system. This allows you to restrict access to directories,
pages, and even specific page elements (like links or forms) based on
the connecting host, user account, group membership, or permissions
granted. The identity system itself is pretty extensible and can
probably be made to support anything you can think of as an
authentication method.

Scheduled tasks can be handled from inside of turbogears with the built
in scheduler. This allows you to schedule tasks while working inside
turbogears, which saves the headache of handling database access
separately.

Installing and configuring Turbogears can actually be pretty simple.
The system is based around python eggs (
http://peak.telecommunity.com/DevCenter/PythonEggs/ ) which can handle
installation requirements and upgrades for you.

Overall I have found Turbogears to be a flexible, easy-to-use
framework. It generally seems to do well at staying out of the way, and
most of the extra features it adds have been well worth the (optional)
time spent learning them.




More information about the Python-list mailing list