- Spyce
Spyce is technology similar to
PHP that can be used to embed Python code intowebpage s. Spyce isfree software , distributed under aBSD-style licence , with some additional restrictions about documentation notices [ [http://spyce.sourceforge.net/docs/license.html Spyce - Python Server Pages (PSP) ] ] .Common Spyce Embedding Methods
Since Python uses indentation to determine the beginning and end of a block, Spyce includes several ways to embed Python code. Shown below are the three most common ways. Spyce supports ASP/JSP-style
delimiter s (<% and %>) as well as double braces (and ). 1. Python 'chunks' (multiple Python statements with traditional
indentation ):It's right now!from time import asctime, localtimeprint asctime(localtime())
or
It's <%from time import asctime, localtimeprint asctime(localtime())
%> right now!
2. Individual statements within delimiters (indentation not required):
Hello, } or
<% for x in xrange(3): { %>
Hello, <% } %>3. Expressions evaluation
I am = 5*3 years old.or
I am <%= 5*3 %> years old. The techniques above can be freely mixed and embedded in any
HTML document.Any legal Python code can be embedded and any Python module can be imported, which makes it especially suited for writing very robust applications (using
exception handling and unit testing single modules individually).Features
Some other features include custom tags (ala JSP), spyce lambdas and
active handler s (reminiscent of ASP).Requirements
Spyce brings Python's standard library and the programming language itself to the web. The minimum requirement is a working Python installation (it ships with a standalone web server written in Python that can be used during development), although it can be used in conjunction with several web servers such as Apache and IIS in a variety of ways.
Configuration is done using Python modules that are imported by the web server during initialization, so all that is really required to get started with Spyce is basic knowledge of Python.
References
See also
*
mod_python
* [http://www.neotitans.com/resources/spyce-tips-and-techniques.html Spyce Tips and Techniques]External links
* [http://spyce.sourceforge.net/ http://spyce.sourceforge.net/] (Official website)
Wikimedia Foundation. 2010.