Getting Started with website

How to Install and Run It

What is website?


This is a pure Python application. It runs under Python 2.5 or higher, but unfortunately not under Python 3.X. You will need the following Python libraries in place to run website:

  • Babel: Used to format dates in templates
  • BeautifulSoup: Used for syntax highlighting and pseudo-protocol links
  • dateutil (optional): Strongly encouraged for its date_parse method. Otherwise you will have to use a stripped-down version of datetime.strptime.
  • Mako: Templating system in use
  • Pygments: Syntax highlighting library
  • Simplejson as fallback, if there is no native json
  • SQLite3 (optional): this is needed, if you want search functionality based on PHP on your site

All of these can be installed via pip or easy_install.


Install either via pip or easy_install:

$ pip install website
$ easy_install website

or download website from Github: and unpack it somewhere in your Python path. Alternatively you can use the website folder directly to start your project in.

Starting a Project

Create a folder and change into it:

$ mkdir my_site && cd my_site

Create a folder _articles. In that folder you will put your posts later.

$ mkdir _articles

Create the configuration file

$ cat <<EOCONFIG >
> URL = ""
> TITLE = "My new blog"
> AUTHOR = "Your Name"

If you want to modify the default templates, create a folder _templates and put there any template that you want to change (see the installation of website for the template file names).


Creating the Site

Put a blog post in _articles. You can use sub-folders to organize your posts. These will automatically translate to categories on the finished site.

Every blog post consists of a header of key-value pairs, then an empty line followed by the actual post in HTML. The header must at minimum include the title:

Title: A Minimal Post

<p>This is a minimal post.</p>

When you’re finished, run

$ python -m website.__main__

Your website is now in the folder site. Upload it to your web space or however you want to bring it live.

Version Controlling

I strongly suggest you to use some kind of version control system to keep track of changes on your site. My recommendation is Git, but you can use any version control system you like.

If you use, for example, SVN, you should place this line in your file: