Skip to content

Instantly share code, notes, and snippets.

Where people struggle learning Django

Over the last 3 years or so I've helped a bunch of companies, small and large, switch to Django. As part of that, I've done a lot of teaching Django (and Python) to people new to the platform (and language). I'd estimate I've trained something around 200-250 people so far. These aren't people new to programming — indeed, almost all of them are were currently employed as software developers — but they were new to Python, or to Django, or to web development, or all three.

In doing so, I've observed some patterns about what works and what doesn't. Many (most) of the failings have been my own pedagogical failings, but as I've honed my coursework and my skill I'm seeing, time and again, certain ways that Django makes itself difficult to certain groups of users.

This document is my attempt at organizing some notes around what ways different groups struggle. It's not particularly actionable — I'm not making any arguments about what Django should or shouldn't do (at least

How I expect it to work:
Me: "Hey MIT, can I have Noah's key?"
MIT: "Sure, it's OxABCD"
Me: *signs message with OxABCD*
Me: "Great, now only Noah can read this!"
How it works with a MITM:
Me: "Hey MIT, can I have Noah's key?"
@jacobian
jacobian / pn.py
Created February 4, 2013 17:00
Work around Pubnub swallowing errors until https://github.com/pubnub/pubnub-api/pull/179 is merged.
import urllib2
from Pubnub import Pubnub as OriginalPubnub
class Pubnub(OriginalPubnub):
"""
The Pubnub client library silently swallows errors on sending a message
(see https://github.com/pubnub/pubnub-api/blob/master/python/3.3/Pubnub.py#L399-L400).
This works around that problem by copy/pasting the _request() function
and removing the bare except.
def session(**kwargs):
s = requests.session()
for k,v in kwargs.items():
setattr(s, k, v)
return s
@jacobian
jacobian / gist:4234944
Created December 7, 2012 17:35 — forked from jnoller/gist:4234922
Rough Draft

Preamble

By now, if you're linked in to current Python / [Python Software Foundation News][1] you know that as of November 21, 2012 the [PSF now requires][2] that all conferences it sponsors, or provides grants to (and there are many), have a code of conduct in place. The exact wording of the reslution the PSF board ratified is this:

RESOLVED, that the PSF will only sponsor conferences that have or agree to create and publish a Code of Conduct/Anti Harassment guide for their conference. A basic template to work from has been generated by the Ada Initiative at [http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy][3]

Before I go much further; I'm going to state unequivocally that I am the one to blame (if you want to assign it as such) for this. I proposed, argued for it, put it on the agenda and argued for it vociferously during our meeting. However, the board approved it overwhelmingly as a body with a single abstension.

Additionally, as you read this, do not assume anything abou

@jacobian
jacobian / hobbyfarm.md
Created November 5, 2012 12:45
Hobby farm reading list

On Twitter, Justin asked:

Are there books / resources for hippies like me who are interested in minimal living, tiny homes, farming, bicycling?

Here's my answers:

  • The Self-Sufficient Gardener is my bible on gardening. The deep bed method lets you grow about twice as much in the same square footage in a way that doesn't require any tools beyond a spade and fork (and some back-breaking initial labor, natch). How to Grow More Vegetables is also very good.

  • Country Wisdom and Know-How is this incredible collection of articles on everything from woodlot management to canning and preserving to building fences and barns.

# All bindings refer to the current screen.
config defaultToCurrentScreen true
# Nudge/resize commands refer to % of screen sice.
config nudgePercentOf screenSize
config resizePercentOf screenSize
# my old divvy bindings (might wanna replace these some day?)
# corners: q/e/z/c for nw/ne/sw/se, quarter screen
alias resize-quarter resize:screenSizeX/2;screenSizeY/2
class PatchMethodOverrideMiddleware(object):
"""
Support X-HTTP-Method-Override: PATCH.
This isn't 100% support, since it's just here to work around ELB
not supporting PATCH. So this only allows "converting" POST to PATCH.
"""
def process_request(self, request):
if request.method == 'POST':
override = request.META.pop('HTTP_X_HTTP_METHOD_OVERRIDE', '')
@jacobian
jacobian / gist:3139864
Created July 19, 2012 00:12 — forked from idan/gist:3135754
A Sample Post

Hello there! This is a sample post — in reStructuredText! — for gist.io, a super-lightweight writing soapbox for hackers.

Now look up. Further. Above the post title. See that grey text with the gist ID?

Now back to me. That grey text is a link! Open that sucker in a new tab to see the source for this post. Also, I'm on a horse.

This is a major heading

@jacobian
jacobian / wsgi.py
Created July 9, 2012 21:28
Auth a whole django site
import os
import barrel
REALM = "PRIVATE"
USERS = [('jacob', 'hunter2')]
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
from django.core.wsgi import get_wsgi_application
application = barrel.cooper.basicauth(users=USERS, realm=REALM)(get_wsgi_application())