<?py mod_npy ?>
main page
news
how it works
documentation
benchmarks

project page
downloads
web svn
cia stats

Hosting provided by:
SourceForge.net Logo

Take for example this simple page code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>t1001.pyml</title>
  </head>
  <body>
    <p><b>Test 1001:</b></p>
    <p>This test uses Python to display simple <i>Hello World!</i> message:</p>
<p style="color: green; font-size: xx-large; font-weight: bold;">
<?py
import response

response.out("Hello World!")
?>
    </p>
  </body>
</html>

(this code comes from tests/t1001.pyml)

What mod_npy does is to take such file as above and in order:

  1. if it's plain HTML (to be correct: everything that is not a Python code block) - send it to client
  2. if it's Python code - execute it

So:

  1. first part (black color) is sent to client
  2. second part (blue color) is executed by Python
  3. third part (also black color) is sent to client

You can use everything what Python Library has to offer, so mod_npy compared to mod_php is quite small, it just provides some needed functions and handles running Python code.