Skip to main content

Simple and extensible static site generator written in Python.

Project description

StaticPIE

Simple and extensible static site generator written in Python.

Package version Package version

Features

  • simplicity
  • extensibility
  • live update (changes are visible in browser right after saving the file)
  • jinja2 templates
  • front matter markdown

Installation

pip install staticpie

Create a new website

pie create website mywebsite

Create page

pie create page anotherpage

Edit page

The pages are editable front matter markdown files. That means the pages are divided into two parts:

  • metadata part written in YAML
  • content part written in Markdown

Both parts are separated by ---.

Serve the website

To edit page open the *.md file in any text file editor and run:

pie serve -c mywebsite/mywebsite.yaml

The command will generate the website in public folder (given in config file), run http server and open the website in browser.

After successfull execution of serve you should see screen similar to below:

Once the file is saved, the browser refreshes the website (or some parts of it).

Deployment

The serve action generates the website for localhost. That means it replaces all the addresses to localhost. The deploy option should be used to generate website with parameters given in yaml config file:

pie deploy 

Configuration

The configuration is a YAML file and contains following elements:

  • PUBLIC_FOLDER - where the website should be deployed (or served)
  • BASE_URL - the website domain
  • PROTOCOL - http:// or https://
  • includes - list of files that should be copied to public folder (css, js, imgs)
  • extensions - list of extensions (elements) used on website
  • and other elements (such as extension configs, etc.)

Example configuration:

# deployment folder
PUBLIC_FOLDER: ./public_www
# the URL used for deploy
BASE_URL: www.example.com
# the protocol http:// or https://
PROTOCOL: http://

# Folders/files that should be copied to public folder
includes:
    - assets
    - styles.css
    - styles.rtl.css

# Extensions
extensions:
    - menu
    - tags
    - pagelist
    - search
    - mostrecent

# Extension config
tags:
    tags_ignored:
        - movie
    tags_map:
        art:
            label: Article # the `art` tag will be displayed as Article
            order: 100
        art2:
            label: Annother article category
            order: 101

Extensions

Most of the parts of this engine is written as extension.

Writing a custom extension is straightforward and can be described in a few steps:

  1. Create a python (*.py) file in the extensions folder inside the root webside folder. It can be also a folder with a *.py file of the same name. Example:

    mywebsite
    +- mywebsite.yaml
    +- extensions
       +- myextension.py    # 1st way
       +- anotherext        # 2nd way
          +- __init__.py
          +- anotherext.py
    +- ...
    
  2. The extension file (i.e. myextension.py) contains a class that inherits from Extension class. Example:

    from pie.core.extension import Extension
    class Myextension(Extension):
        ...
    
  3. Finally, the Myextension class implements at least one of the following methods:

    • on_generation_start,
    • preprocessing,
    • postprocessing,
    • on_generation_end.

    The details can be found in pie.core.extension.Extension class.

Project details


Download files

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

Source Distribution

staticpie-0.4.2.tar.gz (391.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

staticpie-0.4.2-py2.py3-none-any.whl (419.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file staticpie-0.4.2.tar.gz.

File metadata

  • Download URL: staticpie-0.4.2.tar.gz
  • Upload date:
  • Size: 391.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.4

File hashes

Hashes for staticpie-0.4.2.tar.gz
Algorithm Hash digest
SHA256 472c26e6eea434c3f95293b3366e274197df02d1e72fca4beb1f6724eeabf9f2
MD5 17a88daf4e5dd58a057bb4e736a817e4
BLAKE2b-256 cbe316cc28e31963e1fbc7c2eb5332ea6cf94394c761c88c0fcc1532e284a307

See more details on using hashes here.

File details

Details for the file staticpie-0.4.2-py2.py3-none-any.whl.

File metadata

  • Download URL: staticpie-0.4.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 419.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.4

File hashes

Hashes for staticpie-0.4.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5e41a33cec4fbf66ceb6e9810ef2f9e6cd6d6c2ba92b346fbf757e181a49a637
MD5 2b1a33e5deca28e910e594f82a8cd2c6
BLAKE2b-256 70673b69b11d05fd2e18876d6a65281a5f8e894de1ee54fbe3c35812192db51e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page