|
![]() |
![]() |
![]() |
1.3. Getting Started After installing Spyce, you are ready to write your first Spyce page. Start by editing a file called hello.spy in some web-published directory (a directory served by your webserver, and where .spy files will be handled correctly). Enter the following Spyce code:
Note: This manual assumes a knowledge of Python and focusses exclusively on Spyce. If you do not already know Python, it is easiest to learn via this short tutorial, and has extensive documentation. Save the file, and execute:
The output should be:
You might want to see this inside a browser! For this, you need a Spyce enabled web server. Spyce can integrate into a number of web environments, but the easiest for the purposes of "getting started" is the built-in Spyce web server. You can run it by typing:
Replace port with some other port number, or omit the -p switch and assume the default, which is port 80. Replace root with the root document directory; the default is the current directory. All web requests are served relative to the server's root document directory. Windows users should note that there is no command called spyce installed on their system. They should execute, instead:
Now, if you fire up your browser, and browse to:
then you will see the file: root/some_path/hello.spy and the output should be:
If you are curious, you can see the Python source code of the compiled Spyce script. It sometimes helps to understand the transformation that is taking place. Execute:
That's all folks! You have just written your first Spyce script. Having performed the obligatory Hello world! ritual, we now describe the Spyce language more systematically.
| |||||||||||||||||||||||||
|