This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Spyce" software – news ·newspapers ·books ·scholar ·JSTOR(May 2021) (Learn how and when to remove this message) |
| Spyce | |
|---|---|
| Website | spyce |
Spyce is technology similar toPHP that can be used to embedPython code intowebpages. Spyce isfree software, distributed under aBSD-style licence, with some additional restrictions about documentation notices.[1][2][3][4][5][6]
Since Python uses indentation to determine the beginning and end of a block, Spyce includes several ways to embed Pythoncode. Shown below are the three most common ways.Spyce supportsASP/JSP-styledelimiters (<% and%>) as well as double braces ([[ and]])
It's<b>[[\from time import asctime, localtimeprint(asctime(localtime()))]]</b> right now!
or
It's<b><%\fromtimeimportasctime,localtimeprint(asctime(localtime()))%></b>rightnow!
[[for x in xrange(3): {]]<b>Hello,</b> [[}]]
or
<%forxinxrange(3):{%><b>Hello,</b><%}%>
<b>I am [[= 5*3]] years old.</b>
or
<b>Iam<%=5*3%>yearsold.</b>
The techniques above can be freely mixed and embedded in anyHTML 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 (usingexception handling andunit testing single modules individually).
Some other features include custom tags (ala JSP), spycelambdas andactive handlers (reminiscent of ASP).
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.
Thisprogramming-language-related article is astub. You can help Wikipedia byadding missing information. |