Home arrow Python arrow Using Spyce

Using Spyce

If you are looking for a way to embed Python within HTML you might want to take a look at a web environment called Spyce. Two of its advantages are its features and its flexibility. Keep reading to learn how you can Spyce up your programs.

  1. Using Spyce
  2. Basic Syntax
  3. Active Tags
  4. Handling Form Data
By: Peyton McCullough
Rating: starstarstarstarstar / 9
January 17, 2006

print this article




The idea of “Python Server Pages” is nothing new or unique to one particular web environment. It's an idea that is featured in several environments, including mod_python and Karrigell. However, while mod_python and Karrigell don't completely focus on embedding Python within HTML, a web environment named Spyce does. Spyce allows for Python to be embedded, but it also contains a few more tricks when it comes to embedding, such as active tags. Moreover, the fact that Spyce can be used with several technologies with minimal configuration is a huge advantage. In this article, we'll take a look at how Spyce is configured and what it offers.

Installing Spyce

Spyce can be obtained at SourceForge:


Simply download the archive and extract it to a directory that's easily accessible.

Spyce can be installed in numerous ways, which is convenient since you probably won't have to change the face of your existing environment in order to benefit from Spyce. You may choose to run Spyce as its own web server, which can run behind Apache, or you can use FastCGI, mod_python or plain old CGI. Spyce already comes with configuration directives that can be slightly modified and then used with Apache.

To run Spyce as its own web server, open the directory where you extracted spyce and run the file spiceCmd.py with the “-l” flag:

spyceCmd.py -l

Spyce is configured to run on port 8000 by default. If you wish to have Spyce listen to a different port, open the file spyceconf.py and change the port variable.

The remaining installation options require spyceApache.conf to be modified. Open it up and replace “XXX” with the directory to where you extracted Spyce. The file contains configuration directives for running Spyce behind Apache, running Spyce with FastCGI or CGI and running Spyce through mod_python. Simply uncomment the appropriate section of the file and make sure that all other sections are commented. Next, make a copy of spyceApache.conf and drop it in the conf directory of your Apache installation. Open up Apache's httpd.conf and add this directive to the end:

Include conf/spyceApache.conf

Spyce should now be configured to work with your method of choice.

>>> More Python Articles          >>> More By Peyton McCullough

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Python Big Data Company Gets DARPA Funding
- Python 32 Now Available
- Final Alpha for Python 3.2 is Released
- Python 3.1: String Formatting
- Python 3.1: Strings and Quotes
- Python 3.1: Programming Basics and Strings
- Tuples and Other Python Object Types
- The Dictionary Python Object Type
- String and List Python Object Types
- Introducing Python Object Types
- Mobile Programming using PyS60: Advanced UI ...
- Nested Functions in Python
- Python Parameters, Functions and Arguments
- Python Statements and Functions
- Statements and Iterators in Python

Developer Shed Affiliates


Dev Shed Tutorial Topics: