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.
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 :
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:
The basewhat library was an experiment in spinning off open source components rather than keeping it all monolithic. Baby steps.
The source for dpaste.de (I am not connected with that site) is available.
The source for a simple dpaste-like Django 1.0 pastebin app is on the downloads section of our book website.
Spammer commented :
SOME SPAMMER USING IP ADDRESS 188.8.131.52 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 184.108.40.206 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.