How to Run Your Own Version of This Site


June 20, 2022

1 Introduction

The code for this website is open source, and is available from github. The benefits of using this site are that you can write posts in LaTeX. This is particularly useful if you already know latex and maybe have some things written that you’d like to post online. Using this system allows you to write one LaTeX document and be able to post it online, as well as making PDFs and so on.

There are two ways to use this website. You can either run the content management side of the site locally, and then once you’ve added all the posts you want, use wget to render the site to static html. This can then be uploaded to any html hosting that you may have access to. For example you may have some web hosting with your department, or have access to very cheap static html hosting. For cheap hosting I’d recommend digital ocean. They offer free static html hosting. The other option is to self host a server that runs the django app that you would otherwise run locally. This is a bit tricky to set up, but once it is set up it means that you don’t have to keep copying the new html documents that you make whenever you want to post something.

2 Running Locally

To run this locally you’ll need to have python, make4ht and virtualenv installed. Now open a terminal window and clone the blog repo with

git clone https://github.com/alfredholmes/latex-blog \\  
cd latex-blog

Now follow the instructions on the github Readme to get the local version of the blog site running. Once that is done you can use the admin site to add your posts to the site. At the moment the code for running the site is pretty minimal, so its missing some important features, like adding images to posts, but these will be added in due course.

Once you’ve added everything you want to add, you can create a html copy of the website by running the command

mkdir static-html  
cd static-html  
wget --mirror --convert-links localhost:8000

This html can then be uploaded to any static web hosting that you have.

3 Running Online

To run the website online you need to do two things. The first is to get a server online, and the second is to install and configure the required software. Again, I recommend digital ocean, but this hosting will cost a minimum of $5 per month versus the static html, but with the link you’ll get 2 months for free if you want to try it out. Once you have a web hosting account of some sort, make a new server. I recommend picking Ubuntu for the OS, which will be the assumption for some of the commands below on how to install the software. Once you’ve logged in, install the required LaTeX packages with

apt-get install texlive-extra-utils

Now follow the guide on the github repo to get the django server running locally on the webserver, and then follow a guide on how to get a django app running on a hosted server - I plan on writing about how to do this but I don’t really have anything to add to other guides.