Distant Constructs

Technical Details



One of the most interesting topics for me when looking at something, whether a program or a work of art, is understanding how it was made. This page is meant to provide some details on how this site (which may be neither interesting nor a work of art) is made.

Details about this site

Currently, I compose the content and site using Django, a Python web framework. Using Django provides several advantages. The admin screen provided by the framework also makes it much easier to manage It allows me to maintain objects such as pages and news items in a strutctured manner. Also, I can easily modify these objects through the admin page provided by Django. It is also straightforward to set up templates, which makes creating pages that serve as connective tissue (such as those found in all_pages. To edit templates and the HTML content of the pages themselves, I use vim.

Hosting (free!) is graciously provided by Neocities. They do not have forced advertising on their free websites, which is very important to me.

However, the process of uploading this site is a bit convoluted due to lack of support for the version of Django that I developed this site on (1.7+). As a work around, I run the Django server locally and then use wget -m[1] to create a static snapshot of all of the pages. I then use rsync -rlpgoDcv --safe-links to copy over files to a staging area for ftp based on actual differences in the files, rather than the modification timestamp. By doing so, I can restrict the files updated in the ftp staging area to only those that were updated. This does have some major drawbacks. It precludes the possibilty of creating server side applications in Django and also does not allow me to edit the content of the webpage through the admin page on the webpage itself. Some minor advantages include that I can preview the uploaded content locally before uploading. It also spares me from the hassle of setting up and maintaining a database instance on the host's server. It seems that there may also be significant security benefits to using flat files for web content.

When this site was on a host that used ftp, I used to use lftp to ftp files to the web server. I have the following line in an executable bash script which I use to sync files from my local drive to the web server. I have put in an exclusion rule to prevent temporary vim files from being uploaded. lftp -c "open -e 'mirror -R --only-newer -x \"\.swp$\" --verbose ~/local/dir/path/ /remote/dir/path/' -u username,$(pass accountName) sftp://site/path" In order to avoid storing passwords in plaintext, I use the pass program set up as described in this Linux crypto post. This also has the advantages of being automated and easy to call while in vim. Also, through the use of pass, I only need to enter my passphrase once and credentials are then cached for an hour. Formerly, I used filezilla for this.

Pages are meant to be HTML5 compliant. The link in the site-wide footer can be used to check if a page is compliant.

I use this CSS generator to help generate the CSS styleshets used on site.

I use Django's built in syndication and sitemap support to create the feeds and sitemap.xml file for this site.

To check that links are in working order, I use linkchecker, which also has a neat site link visualization feature (through linkchecker -odot -v https://electrons.neocites.org | dot -Tps > sitemap.ps).

Source Code

The source code of this site is available at both Github and Gitlab. These are kept in sync with each other.

[1] I am not alone! I ran across these instructions to statically mirror a framework-hosted website using wget and someone else using similar methods. In fact, it looks like there are whole applications, such as Middleman, developed for the purpose. It looks like my approach to the hosting problem is not as uncommon as I had previously thought.


first published: 2017-09-29 0126 EDT
last updated: 2017-09-29 0126 EDT