Contribute Media
A thank you to everyone who makes this possible: Read More

Dynamic static sites with Django and Sphinx


On a content site these days, especially on a personal project, or where the team are technical, you often don't want the limitations and complexity of full CMS. No, you want to use familiar tools: you want to write in Markdown and manage your content in git.

That doesn't necessarily fit the traditional Django workflow. You end up looking at a static site. This is fine but you loose the ability of Django to serve dynamic pages. You have to decide which of the numerous generators you're going to use, or whether indeed you'll roll your own. It's a bit of a mess.

You can have the best of all worlds though. Sphinx, yes the documentation builder, is a super capable static site builder. You can use it to build your content. Yes it can handle Markdown. Then you can use Django to serve that content, given auth, forms, interactivity, custom content, and all the rest of it.

I'm going to show you how.

The talk has two parts: Sphinx and then Django.

  • First we'll introduce using Sphinx to manage and build your content.
  • We'll look at project setup so you can use Markdown for files.
  • We'll organise those on the file system, and use git to manage them, rather than a full-blown CMS.
  • We'll push to GitHub and use a GitHub Action to build on each commit.
  • Then we'll setup Django to serve our Sphinx built content.
  • We'll use the DTL to get control over our templates.
  • And we'll add auth, to provide dynamic per-user content.

From there, the sky's the limit. Content management never looked so rosy.


Improve this page