Hilenium Blog and Articles about Website performance and hosting

Blog

Building a High Performance Web Application in Django, Redis and Elasticsearch in 2 Days

The Daily Spin was built with Django, Elasticsearch and Redis

Strange as it may seem but the web world isn’t just about PHP7 and WordPress. While these are certainly awesome technologies, they just aren’t the right tools for all projects.

When it comes to building high performance web applications, WordPress often feels like putting a square peg into a round hole. Sure, there are plenty of awesome plugins that provide lots of sophisticated app-like functionality, but you often need to make lots of compromises. Sometimes its just easier to build things from scratch.

When I need to build a lean web applications quickly, I typically rely on Django and Python, especially when data analysis and data manipulation are part of the project. Python is awesome for handing data and Django is a feature rich framework that makes it easy to build great apps quickly.

Literally over the weekend, I built a fully functional high performance web application using Django, Elasticsearch and Redis. This was a passion project specifically to solve a particular pain point in my life.

I’ve mentioned previously on this blog that I’m an avid cyclist. I try to ride 250-300 km per week. I’d love to do more kms but I do need to juggle parenting and work with my cycling addiction 😉

While I’m a really passionate cyclist, I’ve always struggled to keep up to date with cycling news and industry events. There are so many great cycling news sites on the interwebs, and that’s the problem. There’s just too many. It’s too hard to keep on top of them.

Facebook used to be the perfect tool for this. Years ago, I followed my favourite cycling publishers and brands and, for a while, my feed was full of interesting content. However, as the organic reach of articles on Facebook has declined, so too has it’s utility (for me anyway). I simply no longer see the content that I want on Facebook. 

So, over the weekend I built a web app that aggregates cycling news from all the top global publications to make it easy to find the content that I’m interested in, rather than the sponsored content that Facebook wants me to see.

The app is called The Daily Spin and it aggregates news, articles and reviews from loads of different cycling sites. Articles are pushed into Elasticsearch and indexed to make searching across topics and publications really simple. The index is updated every regularly to ensure currency.

It’s meant to make it easy to browse great cycling content.

Of course, being performance obsessed, even my side projects need to be highly performant. Thankfully, the wonderful Django ecosystem makes this very easy to achieve. 

Here are the main libraries and tools that I used to build The Daily Spin in less than 2 days:

  • Django 2.0 – core framework
  • Python 3.6 – programming language
  • Django Cookiecutter – to quickly bootstrap a well structured Django project
  • Postgres – relational database
  • Elasticsearch – document storage engine for searching and analysing text content (much faster and more effective than doing ‘like’ queries over massive datasets in a relational database)
  • Django Haystack – a Django library for interfacing with Elasticsearch
  • Redis –  in-memory data structure store for caching responses
  • DigitalOcean – awesome, developer friendly hosting
  • Cloudfront – Content Delivery Network

Please don’t hesitate to reach out if you have any questions about building high performing web applications in Django and Python (I’m based in Brisbane, Australia).

If you happen to be interested in cycling, please take a look at The Daily Spin on the web and follow it on Facebook, Instagram and Twitter.

Feedback is appreciated.

 

Subscribe for website performance news

We never sell or rent your details. See our Privacy Policy.