请输入您要查询的百科知识:

 

词条 Spyce (software)
释义

  1. Common Spyce embedding methods

  2. Features

  3. Requirements

  4. See also

  5. References

  6. External links

Spyce is technology similar to PHP that can be used to embed Python code into webpages. Spyce is free software, distributed under a BSD-style licence, with some additional restrictions about documentation notices.[1]

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 delimiters (<% and %>) as well as double braces ( and "> and )

{{Ordered list
| Python 'chunks' (multiple Python statements with traditional indentation):

It's [[\\

from time import asctime, localtime

print(asctime(localtime()))

]] right now!

or

It's <%\\

from time import asctime, localtime

print(asctime(localtime()))

%> right now!


| Individual statements within delimiters (indentation not required):{Hello, }

or

<% for x in xrange(3): { %>Hello, <% } %>
| Expressions evaluation
<b>I am [[= 5*3 ]] years old.</b>

or

<b>I am <%= 5*3 %> years old.</b>

}}

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 handlers (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.

See also

{{Portal|Free and open-source software}}
  • mod_python

References

1. ^Spyce - Python Server Pages (PSP)

External links

  • {{official website|spyce.sourceforge.net}}
{{Application frameworks}}{{compu-lang-stub}}

2 : Free computer programming tools|Python (programming language)

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/11 13:59:14