Practical Business Python

Taking care of business, one python script at a time

Wed 24 September 2014

The Technology Behind PB Python

Posted by Chris Moffitt in articles   

I do not intend to spend a lot of time on articles about web servers or other matters related to setting up python-based applications on the internet. However, I will take some time to walk through how this blog is set up and how I think it shows the spirit of using the diverse python eco-system to build a simple, scalable solution that meets my needs.

The first part of this article will describe my reasoning behind my technology choice. I will provide a follow on article that describes how I set up my system.

Blogging Options

When it comes to setting up a blog, you have one big questions to answer:

  • Do I want to host my own site or use an available service?

There are lots of possible options for hosting your blog such as WordPress, Tumblr, Blogger. The key benefit with these services is that setting up your blog may be as simple as signing up for the service and start typing away.

The other option is to host your own site. You can even use some of the turnkey solutions above in your own setting. For the most part, I believe in Eating my own dog food. I decided that I wanted to host my own site but do it in a way that is relatively simple manner.

I have set up blogging sites before with my own custom code. There are certainly technical challenges but the biggest concern is that it does require time to configure a server and maintain it over time. Even a simple blog platform requires knowledge of web servers, database servers and linux environments. Believe me, it is great to learn these technologies and it can be fun. However, you need to be prepared for the long haul. I want to keep my time free to focus on the content of this site and not the administration of the underlying guts.

In keeping with the spirit of PB Python, I wanted to do a couple things:

  1. Use python
  2. Get up and running quickly
  3. Solve my problem
  4. Make sure the ongoing maintenance is manageable

These guiding principles apply to almost all the solutions I’ll be walking through in my future entries.

Static Blogs

I have hosted my own blog in the past but as I started looking at options for this site, I found that there are lots of technologies that allow you to create a static blog. As I read more about the options, I realized that this was the best option for this site.

Statis blogging software essentially takes a collection of text files and creates an HTML-based site for your blog. The static HTML pages have several advantages over a typical dynamic web site:

  • Speed
    Since all the pages are just simple HTML files, they can be served up quickly by your web server.
  • Simplicity
    There is no need for a database server or complex web server setup. Hosting a group of HTML files is about the simplest thing a web server can do.
  • Portability
    Because all of the content is stored in text files in a handful of directories, moving and backing up is relatively simple. Also, the blogging software is relatively easy to install so upgrading or changing to other servers should be manageable.
  • Version control
    As mentioned earlier, all of the content is stored in text files. This has the added advantage of making it easier to check all the content into a version control system. By having in version control, I can more easily see changes and have a simple backup mechanism. The other added bonus I found was that I could even edit my pages online in my source repository. This turned into a great way to capture ideas when I’m not at home.

A quick note about static blogs. One of the key components of a blog is allowing readers to provide feedback. Normally a static blog wouldn’t be able to handle comments but services such as Disqus allows us to use a 3rd party to manage comments through their own system. Building my own comment management system is another challenge I wanted to avoid. Disqus also has some nice social aspects, provides a central place to manage my comments and is very common in the python world. Hopefully this means the barriers to people signing up for it are very low for this audience.

Pelican

As you can see in the footer, I’ve chosen pelican, for the site. There are many other options out there but I chose pelican because:

  • Written in python
    There are options in Ruby and other languages but I prefer to stick with Python options when all else is equal.
  • Mature project
    Actively being developed since 2010.
  • Actively maintained
    Last release in July 2014.
  • Good documentation
    Documentation includes tutorials on the install, customization and themeing.
  • Lots of plugins
    I am not sure which ones I’ll need now but it’s reassuring to know it is out there.
  • Multiple themes
    This was actually important to me. I am not strong at the actual design of web sites. I know CSS/HTML but am not very good at making beautiful websites on my own. I really liked the ability to look at all the pelican themes that are readily available. Designing sites that work on phones, tablets, laptops, and multiple browsers is tough. I wanted as much help as I could get.
  • Easy to setup and use
    I followed the basic instructions for setting up a virtual environment. This tutorial was a great place to start. I drafted some sample articles and posts and tried it out for a while before deploying. I tried multiple themes, and played around with it. I was able to do everything I thought I needed so I moved forward.

What’s Next

I hope this overview was helpful. In my follow-on article I will expand on how I installed the blog, how I am hosting it and my basic workflow.

Comments