python

Website management python script

This is a little script I created to help manage this website. It does 2 things:

1. It does basic macro expansion/replacement on html files. This allows html files to contain non-html tags which can be expanded into html based on the values in a configuration file. For instance, since every html file has the same header, its possible to include an <auto_update_header> tag in every html file and then have 1 definition of <auto_update_header> it in a configuration file. Its then easy to update the entire site’s html by modifying the configuration file and running update_html.py. This makes it easy to make sitewide changes and ensure all pages are up to date.

2. It “intelligently” uploads the website a webserver via FTP. It would be easier to use a standard FTP tool which could perform syncing, but there are many files that I don’t want to be uploaded (eg. .svn directories, non-gif or non-jpg images, etc). The FTP server address, username, and password as well as file and directories to be ignored can be specified in the same configuration file referenced above.
The script is very simple at this point, but should evolve as this webpage does.

Download update_html.py
Download update_html_example.conf
Download update_html_example.html

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>