Skip to main content

Yet another static website builder. A good one.

Project description


This is a static website builder with the following features:

- Works out of the box.
- Capable for blogs and websites with arbitrary content structure.
- Uses `markdown <>`__ page
sources and `Jinja2 <>`__ templates.
- Includes neat and responsive default theme based on `Twitter
Bootstrap 3 <>`__.
- Provides optional JavaScript, CSS and HTML minification.
- Can generate `sitemap.xml <>`__,
`robots.txt <>`__,
`humans.txt <>`__, and atom feed for blog posts.
- Supports `LESS <>`__ stylesheets.
- Local host site preview.
- Code hightlighting based on `Google Code
Prettify <>`__.
- Supports Disqus comments and Google Analytics.
- Tags.


The latest stable version could be installed from PyPI:

.. code:: bash

pip install publicstatic

Use this command to install latest development version directly from

.. code:: bash

pip install -e git+git://

Default website configuration uses Yahoo's yuicompressor for CSS and
JavaScript minification. To use this tool `Java
runtime <>`__ should be

Basic usage

The following command creates a new website source in the current

.. code:: bash

pub init

Use the following commands to add posts or pages:

.. code:: bash

pub post "Good news everyone!"
pub page "True story"

With default configuration this commands will create a new post supposed
to be located at ````, and a
page ````.

After adding some content the website should be built.

.. code:: bash

pub build

This command will generate HTML pages using text content and template
files. Build output will also include CSS files and any other assets
included to the website source. Generated website could be previewed
right on the local host:

.. code:: bash

pub run -b

``-b`` option tells public-static to open site root page using the
default browser.

The last operation is to deploy generated web content to the destination

.. code:: bash

pub deploy

This command suppose to use external tool like ``rsync`` or ``aws`` to
synchronize local web content directory to the remote one. The actual
command should be predefined in the configuration file as ``deploy_cmd``
parameter value. Here are some examples. In each case ``{build_path}``
will be replaced to the actual local build path.

- Uploading content with ``rsync`` via SSH:


rsync -avz {build_path} <username>@<host>:/website/public_html/

Username host and path to the destination directory should be
replaced with actual values. Password-less SSH login will also be
very helpful here.

- Using `aws-cli <>`__ to upload files to
S3 bucket (this is a recomended crossplatform solution):


aws s3 sync {build_path} s3:// --acl public-read --delete

This assumes the aws `authentication
setup <>`__
is already performed. ```` should be replaced with the
actual bucket name.

- Using `s3 tool <>`__ on Windows:


s3 put {build_path}\* /sub:withdelete /yes /sync /acl:public-read /nogui

This also requires authentication setup.

- Synchronizing through FTP with ``lftp``:


lftp -c "open -u <user>,<password> <host>; mirror -c -e -R -L {build_path} <path to>"

Use ``--help`` for detailed command line arguments description.

Page file format

Each page is a plain text/markdown file complemented with the optional
metadata in the header. The format is pretty straightforward. Here is an

.. code:: markdown

title: Hello World!
updated: 2012-06-05 13:49:38
template: default
custom-field: Custom field value

# Hello world!

This is the main page contents section.

Some details:

- All header fields are optional. The whole header could be omitted if
you lazy enough.
- Both ``created`` and ``updated`` field values should comply the
default format which is ``YYYY-MM-DD HH:MM:SS``.
- ``template`` value is to be transformed to ``[tpl_path]\[name].html``
file name where ``tpl_path`` is defined by configuration and ``name``
is what specified in the page header.
- All header fields are accessible from template body by name. E.g.
``{{title}}`` will be replaced by the actual title if it's specified.
- Any number of custom header fields could be added.
- Custom field names should consist of alphanumeric characters, dashes
and underscores. All names are case-sensitive.
- Page header fields could have single-line values only.
- Everything beneath the key-value header definition is to be treated
as page content. Template name for this section is ``{{ content }}``.


Public-static configuration resides in a yaml-formatted file
``pub.conf`` in the root of each website directory. ``init`` comand
generates this file with default parameter values and a brief comment
for each of them. Configuration supposed to be updated after site
creation to fit user requirements like site structure, deployment
destination, etc.

Content migration

There is a great tool to export Wordpress data to
public-static-compatible files:
`wp2md <>`__.

| Copyright © 2013 by `Alex Musayev <>`__.
| License:
`MIT <>`__.
| Project home:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for publicstatic, version 0.7.6-p1
Filename, size File type Python version Upload date Hashes
Filename, size publicstatic-0.7.6-p1.tar.gz (26.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page