Coolness I’ve Learned At The Chicago Tribune, Part Three

by Andy Boyle.


The 2012 Elections Ballot Builder was a pretty big undertaking for me on the team. I wasn’t the lead developer on it, but I did learn a lot pairing with my colleagues who helped pave the way. It was also my first encounter with hooking up Backbone.js with a Django app. It was also a lot of fun to truly think and discuss how a user would actually use the app. You can read more about the actual development in this blog post.

The ballot builder was also hooked up with another site that pulled in information our editorial board collected from something like 400+ candidates for various city, county, state and federal positions. The editorial board project taught me a lot about ingesting data from spreadsheets and .csvs, not to mention a greater understanding of Django’s management commands. Sadly, we turned off those election sites a few months ago, so you can’t check out a live site right now.

This project required me to write my first scraper, because we had to scrape data about ballot initiatives from the states’ election website, as they didn’t have a way to get it to us. Also, we had to fight to get some GIS records for the project, an area I haven’t spent much time in since my reporter days. We also built our own shapefiles for some of the various election-specific districts because they apparently didn’t exist anywhere we could get easily from a public source. Everything on both sites was responsive, too, because our idea would be that people may want to use the app while voting.

And you know what that meant? We should have an email functionality on the ballot builder! So we added that, which was also my first introduction to sending emails using SMTP. Previously, I would just hook up a Django project to Google mail and send error messages and other things that way.

Setting up the mail stuff taught me about spoofing a mailserver on your local machine. It’s pretty simple. First, make your settings.py in your Django app on your local machine (this, of course, should mean you’ve got a staging_settings.py and a production_settings.py somewhere, which will override your local development version’s settings, which is something I may go into in a later post) have this:

EMAIL_HOST = 'localhost'

Then you can just open a tab in whatever you’re using for your terminal and type this:

python -m smtpd -n -c DebuggingServer localhost:1025

Remember to Ctrl + C to quit. I also set up an alias in my .zshrc profile for the above python command for pymail. That looks like this:

alias pymail='python -m smtpd -n -c DebuggingServer localhost:1025'

Another interesting thing I learned on this project was designing print style sheets. Definitely something I’d never previously thought about. That’s probably a bad thing.

The application was used by lots of people, and I’d like to think we helped some people make more informed decisions about who to vote for. That’s one of the great things working for a journalistic organization allows you to do — you’ve got a big mouth piece to help inform people about the world around them. I’m happy we were able to do that and further the nation’s democratic ideals.

Big Takeaways

I got to see what happens when you get to design the backend and the frontend of an app. The flexibility it allowed made it easier to fix things and deploy changes. I know one won’t always be that lucky, to control the backend and the frontend, but it was pretty nice.

This project, more than any project previously in my career, I really had to buckle down and learn the nuts and bolts of how everything fit together. I was taking ownership of a big part of it, and I had team members who were busy in their own right, so I needed the confidence that if things broke, I would be able to fix them. Or at least know how to ask the right questions of my teammates so as not to use up a lot of their time.

Looking back, it’s kind of ridiculous how dumb I was going into things. I’ve looked back at the code a few times, as I’ve built a few similar projects recently. So many unneeded functions I wrote. So many weird ways I decided to parse data. So little unit testing.

But hey, that’s learning. Speaking of learning, the project I’m profiling tomorrow has taught me more about being a web developer than almost anything previously. Come back soon!