|
Download RequirementsThis tutorial assumes that you've installed Spyce as described in "3 steps to Spyce" on the Spyce home page. You will also need Sqlite and pysqlite installed. (The changes needed for other databases are obvious, but this tutorial will assume Sqlite.) Creating your projectStart a shell in the directory you wish to contain your wiki application, e.g. /var/www on Unix or C:\ on Windows. Then run spyceProject.py spycewiki This will create a directory named spycewiki and a skeleton project. (This page describes what is created by spyceProject in more detail.) Start the Spyce standalone server: spyceCmd.py -l --conf ~/spycewiki/config.py Point your browser to http://localhost/8000. You should see a "Welcome" page. This is served from spycewiki/www/index.spy. Have a look at that file: so far, there's not much besides a reference to spy:parent. This tag tells Spyce to take the content of the child page (index.spy) and inject it into the body of the parent template (/spycewiki/www/parent.spi). There's no need for separate header and footer fragments in Spyce. Have a look at parent.spi before moving on; child.title corresponds to the "Welcome" title in the spy:parent tag, and child._body is where the child contents are injected. Setting up your databaseThis wiki will have a very simple data model: a single table called pages. Run sqlite spycewiki/wiki.dband create the table by pasting in the following: CREATE TABLE pages ( name varchar(64) PRIMARY KEY, data text NOT NULL ); Next, edit spycewiki/config.py and change the line db = None to db = SqlSoup('sqlite:///spycewiki/wiki.db'). If you still have the shell open that was running the Spyce server, note that Spyce recognized that its config file was changed and restarted itself. You'll never have to manually restart your Spyce server; it will notice whenever you change anything. (For production use, you can turn this feature off since it's a slight performance hit.)
| ||||||
|