The story of dpaste.com 2.0

Eight years ago, I launched a simple pastebin site written in Django.

In those early Django days I spent a lot of time in the #django IRC channel. I thought we should have a pastebin that knew how to correctly colorize our code, and which was written in our framework to boot. So I wrote one. Eventually its URL ended up in the channel topic, then in the Django source code itself.

Over the years, changes have been minimal. I switched from a Javascript-powered colorizer to Pygments. I added an API. I fixed things that broke. Mostly I just kept it running and usable. (I’ll also note that many excellent new pastebins were created in those years as well.)

Of course I kept a growing list of “someday” improvements and fixes. Despite having no free time (full-time job, twin baby boys, 100-year-old house), a year or so ago I started hacking away on the items on that list. In very tiny steps.

Eventually I had enough in place for what I call the 2.0 release of dpaste.com. I presented a preview to my co-workers (many staunch dpaste users among them), and went live about three weeks ago.

I call out the fun new stuff on the about page:

  • about 100 syntax choices, vs. the previous handful
  • “private” (unguessable) URLs for all pastes
  • expiry from 1 to 365 days
  • line number anchors
  • last-ten-pastes history (no login, just a cookie)
  • ability to delete or change expiry for any of those last ten pastes
  • one-click soft wrap toggle (I hate horizontal scrolling)
  • status feed (aka Twitter account) for important news like upgrades or outages

One obvious change is the switch from auto-incrementing integer IDs (1.7 million at last count) to 7-digit base-32 IDs like “1S2BP7E”. This ID is generated by hashing some of the paste data fields, using MurmurHash. I wrote a simple library called basewhat to handle the base-32 conversions.

Some other improvements are less visible but still important:

  • Upgrading from ancient pre-1.0 Django to Django 1.6
  • Upgrading from ancient Pygments to current
  • Gunicorn application server, Nginx reverse proxy (buh-bye Apache!)
  • Fabric for various development, deployment, and maintenance tasks
  • A solid test suite

Every good developer knows that version control plus a good test suite help you go faster with more confidence. If you also deal with the operations side (i.e. deployment), I’d add Fabric to that list. By reducing error and tedium in maintenance and deployment tasks, Fabric likewise increases your likelihood of doing them consistently and correctly. If pulling the latest code to the live server and restarting the app is a single command I can run from anywhere, I’m going to do it more.

Thanks to all the authors of the open source software that this project is built on. And thanks to all the users, who motivate me to keep it going just by using it.

As they say in customer service land, “We know you have a choice of pastebins, and we thank you for choosing dpaste.com.”


Tim commented :

Is the source code of the project available?


orzel commented :

@Tim

I’d like too, but it seems the code is still not available.


Paul commented :

Tim, orzel – thanks for reading and commenting. No, I haven’t released the source of the project.

I’m not sure that I will be releasing the source (though it needs a lot less cleanup for release than the old version would have). A few thoughts:


Spammer commented :

SOME SPAMMER USING IP ADDRESS 23.88.104.176 WHOSE URL I HAVE REMOVED SAYS:

“Simply desire to say your article is as astonishing. The clearness in your post is just great and i could think you’re an expert in this subject. Fine with your permission allow me to seize your feed to keep up to date with forthcoming post. Thanks one million and please carry on the gratifying work.”


Spammer commented :

A SPAMMER USING IP ADDRESS 192.157.239.67 SAYS…

“Magnificent beat ! I would like to apprentice while you amend your website, how can i subscribe for a blog web site? The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast provided bright clear concept”


Spammer commented :

A COMMENT SPAMMER CLAIMING TO BE CONCERNED ABOUT COMMENT SPAM WRITES:

“Hi, i read your blog from time to time and i own a similar one and i was just wondering if you get a lot of spam remarks? If so how do you reduce it, any plugin or anything you can advise? I get so much lately it’s driving me insane so any assistance is very much appreciated”


Paul Bissex commented :

Speaking of good pastebins created after I started dpaste, I wanted to mention paste.pocoo.org. It’s gone now but said in its closing message: “…it turns out, running a pastebin is a horrible idea if you don’t do entry expiration or spam filtering.”

Though I haven’t tried doing without, I tend to agree.