Static websites

To avoid having one Django app running per year, and all complications which come with it, websites of previous years are crawled to make a static copy and the static files are served. Only the current year is served by a Django app.

Example of a static website:


In the conference-web project, remove parts of the website which should not be present in the static website - typically the login links/forms and the dashboard. For example check out `this commit`_.

Crawl a living Django website to make a static copy.

wget --page-requisites --mirror

Create a repo named `<year>.static`_ and push the static site contents there.


How to deploy a static site, such as

Clone the website:

git clone ~/web/2018.static

Configure nginx to serve it:

 server {
   listen 80;

   return 301 https://$server_name$request_uri;

 server {
   listen 443;
   add_header X-Clacks-Overhead "GNU Terry Pratchett";

   access_log /var/log/nginx/;
   error_log /var/log/nginx/;

   ssl on;
   ssl_certificate     /etc/letsencrypt/live/;
   ssl_certificate_key /etc/letsencrypt/live/;

   location / {
     root /home/webcamp/web/2018.static/;

Reload nginx:

sudo service nginx reload

The static website should now be available at