# Django Built a Nonprofit

Source: https://djangotv.com/videos/django-birthday/2015/django-built-a-nonprofit/
Date: 2015-07-12
Speakers: Speaker 1, Speaker 2, Speaker 3

## Summary

James Turk and Jeremy Carbaugh explain how Sunlight Foundation moved from Drupal to Django in 2007 and used it as the foundation for open-source tools supporting government transparency. They describe reusable projects such as moderation workflows, Markdown fields, media storage, Django WordPress integration, and applications that expose state legislation, campaign finance, lobbying, congressional language, and political influence. They also show how Django powered public annotation, civic calling campaigns, data education, and even internal office tools, arguing that Django and its community made Sunlight’s work possible and extensible through community contributions.

## Transcript

### [00:00] Introduction to Sunlight Foundation

**Speaker 1:** [00:00] Welcome James Chirk and Jeremy Carbock.

**Speaker 2:** [00:09] so yeah, as Jacob said, For eight years, Jeremy and I have been working together at the Sunlight Foundation, which is a nonprofit that the goal is really to open government data and to make the government more transparent and more functional. And that has spread from eight years ago when we were only working on federal projects to some of the projects that we'll talk about, you know, working on state level transparency, working on transparency in towns and also on the international level. And you know, we'll get in a little bit more detail on what sunlight actually does in a second here, but Jeremy's gonna give a little bit more background first.

### [00:43] Sunlight’s Move from Drupal to Django

**Speaker 3:** [00:43] Yeah. So when we started in 2007, Sunlight looked like much of the nonprofit world at the time, which was basically a Drupal wasteland. Most organizations didn't put much of a priority on like actual technical So you would find a lot of nonprofits, especially in DC, especially in the government transparency area, that based all that they did on a CMS that was often Drupal and they often contracted other people to build their tools. Sunlight however knew how important it was given the type of work So because of that, when James and I started, we moved Sunlight from Drupal to building almost everything on Django.

[01:29] And it's been a core part of everything we've done since almost day one.

**Speaker 2:** [01:34] Yeah and we were taking a bit of a gamble. It was. 96 at the time. So thanks for keeping working on it. And

### [01:43] Reusable Django Components

**Speaker 3:** [01:43] So one of the things that we learned really on one of the core things about Sunlight is that everything that we've written has been open source. But you know open sourcing is complete tool to view earmarks isn't really that reusable by that many people. So we started releasing like individual components of things, breaking things out into various small pieces and publishing components that had nothing to do with transparency. And some people use them, which was good. So We want to go through a couple of them here and show either cool Django stuff about them or how they reflected the government transparency. movement at the time.

**Speaker 2:** [02:26] Yeah. So back in two thousand nine, two thousand two thousand eight, two thousand nine, you know, crowdsourcing was all the rage and, you know, we were being funded to do a lot of crowdsourcing projects and some of them were valuable. We were doing things like collecting earmarks having people annotate you know, information and having people request data sets that they wanted to see from the government. And so one of the first things one of the first projects that came out of this work with something. It was pretty I mean it was a series of hacks really into the admin, monkey patching a lot of things so that you could do kind of pluggable object moderation so that instead of building a moderation queue for every object in our system you could just we could just use the admin and it had some nice sidebars and things like that where you could see you know which objects were moderated already and things like that so that we weren't getting all sorts of spam and stuff

[03:12] stuff into the system and you know really relying on a lot of what was already there in the admin and 1. 0 or so, but you know taking that and making it something that we could then use on the dozen or so crowdsourcing projects that we would wound up launching. And we use it for things like you know speaker submissions and stuff like that even more recently than that. Another one was, and Jeremy will get into this a little bit more later, but you know, nonprofit has a lot of content to put out, a lot of policy content and a lot of you know just you know writing that winds up on various sites. And you know we wanted to be writing it in you know in Markdown a lot of the time and I think actually I had a conversation with Jacob at some event, I think it was an OSCON or something like that, about what, you know, wouldn't it be nice to store the pre-rendered markup in the database alongside it, kind of a

[04:00] hacked composite field. And so I wound up writing a Django markup field, which has also been used by a lot of projects obviously outside of the government transparency space. And you know, again, really relying on what Django is already offering, but expanding that and you know having a way so that people could you know be editing that markup and storing it in the fields alongside that.

**Speaker 3:** [04:22] Before a lot of the static files improvements that came into Django, we were at this one package, Django Media Sync. It started off as just like a simple management command that would push your static assets up to S3. But some people seem to like it. So this was the first project that I ever released that actually got community contribution. Which felt awesome. But we were able to add lots of great things like pluggable backends, so it would work with Rackspace Cloud Files. You could write your own custom backend for storing your media. It would take care of doing processing like CSS and JS minification, SAS compilation, there's a pluggable system for that. So yeah, a lot of a lot of work went into it, and then static files came out and ruined it all because it was not needed anymore.

[05:08] So thanks Django. And then also one of the more personally useful projects that we've released is Django WordPress. Which is an implementation of models that map to a WordPress database and also default views and routes so that You could basically point it at a an existing WordPress database and all of the URLs and everything that WordPress provides will still work. Pro show your blog. This has been great for sunlight because our website and our entire content publishing system is based on this where Our authors get to use WordPress's authoring interface, which is actually quite nice but we don't have to write PHP and we don't have to find ways to

[05:59] hack you know, WordPress into a larger Django project. So that's that's been incredibly helpful.

**Speaker 2:** [06:08] Do the intro.

**Speaker 3:** [06:09] Yeah. So we wanted to go over a couple projects here to show some of the stuff that we've been able to do at Sunlight. One of the reasons we wanted to do this talk was mostly to thank you all because without Django and the people building the community around it and building the ecosystem around it, we wouldn't have been able to achieve much of what we've done at Sunlight. So thank you and peer some stuff that you all helped us build.

### [06:39] Open States

**Speaker 2:** [06:39] So I think one of the ones that you know this community really helped build in a number of ways, not only Django, but also kind of you know using you know, kind of piggybacking off of an existing Django community, an existing Python community was a project that's near and near to my heart, which is the Open States project. This is a project that collects information from all fifty state governments, standardizes it and puts it into one place where people can do research and find out what's happening in their state house without you know visiting what's often a very terrible difficult to use, mid to late 90s designed ASP government website. And you know, this project was actually built by people That were at PyCon, interested in working on projects.

[07:26] And a lot of them, you know, some people are in this room that have contributed in some ways to this project. And you know, we couldn't have done this type of thing without, you know. this community without you know taking guidance from how Django ran its community you know, doc you know taking guidance from documentation, you know, hosting our docs on Read the Docs. And you know, and then you know hosting the site and the API that gets you know over a billion hits a year now to the API, all through a Django site. And you know So thank you for that. You all helped build that.

**Speaker 3:** [08:00] Yeah, just to make it clear, when he says like contributions, there are 52 individual scrapers that scrape state websites. sites every day, constantly.

### [08:10] Government Influence and Legislative Data

**Speaker 2:** [08:10] And twenty of those were written by people at Sunlight, but 30 plus of those were written by, you know, people at that were part of this community. So another project that was built entirely in Django is our Influence Explorer project, which kind of aggregates campaign finance information and lobbying information, all sorts of information about influence in federal politics and state politics so that people can see you know where money is coming from and going within the government and all of that done in a you know pretty nice, relatively easy-to-use way so that you're not downloading Massive EBDIC files from the FEC, which is how the data is actually put out. And you know, you can look at it like this, and again, that's built by all of you thanks to Django. And

[08:56] this one. The third one is the capital or capital words project, which is kind of a more fun project, something maybe just to bring up on your laptop or phone at some point, which is a project that lets you see what the most common words are used in the federal in Congress every day and also you know compare you know what party uses this word more so you can sort of for just you know anywhere you can search for puppies and see you know who's talking about puppies in Congress or you can search for more serious things too if you'd like.

### [09:27] Public Participation Projects

**Speaker 3:** [09:27] One of our first projects that we did was called public markup. And it was a way to add annotations to the text of legislation. So this project really got its start when during the bailout, bank bailout. up after the financial issues we had. And so we were able to get some text of the drafts of some of the legislation before they were actually introduced. produced and so we got them loaded up on the site and we actually had policy analysts coming and you know giving their comments on various portions of the bill. So I think it really had an effect on you know how some of the final drafting of those bills came through. We worked with

[10:12] IDO design firm to do an app called Sytgeist. We wanted to make government information of approachable and like usable by the average normal person. So we aggregated a whole bunch of different government data sources and some private data sources. as well. Django provided the API that powered all of this but it was basically mobile apps that would give infographic style presentation. They were actually web views, so that was all Django presenting those. We had a web interface that people could use to do demos and stuff. That was one of my favorite projects. A lot of the projects we do also like try, as James mentioned, with Gatekeeper, try to get

[10:58] the public to help us do stuff. So there's a series of projects here.

### [11:03] Political Party Time

**Speaker 2:** [11:03] So yeah, one of those projects and I think one of our favorites, again, all built on Django, including kind of a contribution workflow using You know, things like gatekeeper I believe. And it has been this project political party time. This is basically when people get, you know, those invites that say, Come and spend, you know, three thousand dollars on a you know, chick and dinner to support you know this candidate, those people can forward you know anonymously if they'd like forward those invites to us so that we can you know list them on this site and then you know aggregate that information into a place where you can see you know who's paying what to be where with who, I guess is kind of the long way of putting that. And you know this again was a really impactful project. I think something that really got a lot of attention especially around you know political conventions and things like that

[11:53] and kind of shines a light in an area that you know people don't really think about but that's like where influence it really happens is like you know at these dinners where people are eating you know a little their four hundred thousand dollar hors d'oeuvres or whatever it is. So

### [12:06] Advocacy and Sunlight Tools

**Speaker 3:** [12:06] being an advocacy organization, we try to get people to talk to their members of Congress. So we released a standalone package called Django Callbot 3000, which is basically a tool that lets you create calling campaigns. And so you can like have suggested scripts for people to call. It helps people find who their representatives are. We recently added the start a hangout thing. So you can just click it and it launches Google Hangout that does a voice call to your representative's office. So we've used this for a number of campaigns around legislation to improve transparency. And we also run something called Sunlight Academy that a lot of journalists use. So we'll do tutorials about

[12:52] Sunlight Academy about how to access data, how to interpret data, all sorts of things like that. And we publish all these here. People can come on, like mark the ones that they've completed and get And we've used Django to actually build Sunlight itself. I mentioned Django WordPress for our blog and our site. We built a internal media management tool so that we didn't have to use the one built into WordPress anymore. Called Horseradish. And then we also built our kitchen cleaning day schedule called Cleanosaurus Rex. It's actually mounted in a tablet in a kitchen in the

[13:40] the office that shows whose day it is. You can like reward them or send them anonymous nudges if they're not doing their duty. You get emails when your day is coming. up and stuff. So this is like the critical piece of sunlight infrastructure here.

**Speaker 2:** [13:54] I mean transparency can apply to the kitchen too. Yeah. Really see it see who's doing a good job and who's not. Daniel's doing all right.

### [14:02] Sunlight’s Next Chapter

**Speaker 3:** [14:02] So all good stories have an. N. Shyamalan style twist to them. So this is the part in the talk where we reveal this one. James and I are both actually dead. Which not quite true, but as of two weeks ago neither of us work for Sunlight anymore.

**Speaker 2:** [14:21] So we should probably make that clear. But Sunlight, you know, you know, we really wanted to say, you know All this work would not have been possible. Everything that Sunlight has done and will continue to do without us is you know something that you know really everyone here can take some pride in and you know you've made you've made your country, you've made your state, you've made your cities better places, hopefully, because of all that work. And so, you know, thank you for that and happy birthday, Django.
