pyshcreator: PYthon Simple HomePage CREATOR

Short description

I like a website without JavaScript or PHP. But to add new pages to my site took too much time. So I wrote a little Python program to simplify the task.
For my pages I use Markdown which gives a very readable file, and helps to focus on the content.

The structure of the homepage is given by the directory tree. The names of the directories are also the names and links in menu and sidebar. A simple configuration file allows to change CSS properties like the font-size or background colour.


Installation (Linux)

Python 3 is needed. Tkinter is used for the GUI, and pip may be used to install further libraries. In Ubuntu or Debian:

    sudo apt install python3, python3-tk python3-pip

Paramiko is needed for sftp upload and pygments for color highlightning of code:

    sudo apt-get install python3-paramiko python3-pygments

Other Python modules that are not includeed in Python standard library are markdown2 for the markdown to html conversion, and sftpsync to upload the code to your homepage. Those modules are in the pyshpcreator folder as *.py files.

Another possibility is to install them with pip:

    sudo pip3 install markdown2 sftpsync

But with the downloaded version op sftpsync, I got a syntax error, so use the included version.

The directory structure

As mentioned the structure of the homepage is given by the directory tree.
Per directory we normally find one (and only one) *.md file that is converted to index.html. An exception is the root directory This may contain a second file with the name and a third file with the name The file sitemap.mdis automatically created by pyshcreator.

The root directory contains also a file with the name css_template.css and if you wish a file with the name pyshpcreator.conf.
Other directories that are needed (ex.: png, gpx) are ignored and must be contained in the blacklist (in pyshpcreator.conf). The

Here we see an example of a hompage directory before and after running pyshpcreator:

directory structure

directory structure hp

The main hompage md-file hiking. md gives the main index.htmlfile. Disclaimer, news ans sitemap get there own html-file. In all subfolders one index-file is generated.
Pyshpcreator generates the index.cssfile from the css_template.css file in combination with the pyshpcreator.conf file. If you want a favicon picture, the file favicon.ico has to be contained in the main png directory.


Here the markdown example of the above homepage. The Markdown-Cheatsheet helps with the syntax:

markdown example

The following words in brackets are parsed by pyshpcreator and used to create the html file:


The "TITLE" word expects only one line! Between "SIDEBAR" and "SIDEBAR_END" it is possible to create sidebar links that are not in the directory structure.


The file css_template.css contains the css for the homepage. It contains all the css code and can be changed at will. It also contains keywords in brackets that are parsed by pyshpcreator and replaced by the content of the pyshpcreator.conf files to generate the index.css file.

The "pyshpcreator.conf" files

Two pyshpcreator.conf files can be used. The files are classical config-file which are parsed with the configparser module of python. The main file is in the directory:

main config file

The [GLOBAL] block contains the blacklist (no spaces!) of directories that will be ignored. The [HOMEPAGE_x] block contains the file directory and the data for server upload. The software parses up to nine blocks ([HOMEPAGE1] ... [HOMEPAGE9]).
The [CSS] block allows to change easily the font size and the colors of menus and pages.

A second pyshpcreator.conf file may be used in each homepage directory. This file contains only two blocks ([GLOBAL] for a non default blacklist and [CSS] to change colors etc.). The content of these blocks overrides the content of the main pyshpcreator.conf file. Here a typical file:

main config file


pyshpcreator files