Pyplate is a set of Python scripts that can be installed on a web server to serve pages to web browsers. Pyplate uses templates to ensure that pages have a consistent layout and style, and it uses an SQL database to store information about each page. When the server receives a request from a web browser, it passes the request to one of Pyplate's scripts, index.py in /usr/lib/cgi-bin/. This script looks up the requested URL in the database to see which page has been requested. Pyplate builds pages on demand using information from the database, HTML templates, and posts stored in Pyplate's content directory.
The code for the HTML template is stored in several files in Pyplate's template directory. These files contain a few lines of HTML that are embedded in each page in places like the banner, footer and sidebar. Styling is applied by embedding a CSS file in the head section of the page.
Pyplate uses several layouts in layouts.py in /usr/lib/cgi-bin/. These layouts are strings that tell Pyplate how each page should be arranged. Layouts contain a mixture of HTML, and variable fields which can be filled in with HTML code generated by Pyplate, or code from template files. Posts are stored in HTML files in Pyplate's content directory. When a page is generated, posts from the content directory are embedded in the page along with the template.
Finally the newly assembled page is sent back to the browser that requested it.
Share this page: