Posts – Page 3

"Using Google to Send Mail in Django"

If you have a Gmail account (or a Google Apps account), you can use it to send mail on your behalf just like any other email client. Remember to use port 587 (not 465), and an "application-specific" password if you use 2-step verification.

EMAIL_HOST_USER = 'you@gmail ...

"Decorating Django Tests"

Just a quick note: when decorating Django tests you have to take care to name your return function using the same "test_" format otherwise an unmodified TestRunner will not discover it.

This will work:

def mydecorator():
  def wrapper(f):
    def test_func(*args, **kwargs):
      # Do some stuff
      result = f(*args, **kwargs ...

"Django: A New Way to Write Tests"

Taking a lot of inspiration from Ruby's RSpec, I've established a new way to write my tests when doing TDD in Django. Using django-nose, factoryboy, and a few of my own helpers I have greatly simplified and consolidated test writing.

My file structure:

  +-- app1
  +-- app2
  +-- project
  +-- tests ...

"Mitt Romney and Spain"

Brad Klapper:

"I don't want to go down the path of Spain," Romney said Wednesday night during the first presidential debate. He argued that government spending under Obama has reached 42 percent of the U.S. economy, a figure comparable with America's NATO ally. "I want to go ...

""subject" Decorator for Django Tests"

The Python elite will probably turn their noses up at me, but I just conjured an even better looking way to write my tests.

Using my file I can write the following decorator:

def subject(item):
  def wrapper(f, _item=item):
    def test_func(*args, **kwargs):
      item = _item
      if ...

"Nonrequired Reading"

Via Synapse:

On my desk stand three books that 2501 was kind enough to let me borrow. 2 psychology, 1 management and 1 rethorics. As I was skimming through them I realized something.

Imagine this: These are books that contain secret knowledge. Not everyone can get their hands on them ...

"Mainstream Media Hiding in Your Closet"

FOX News is ready for the big debate tomorrow. They've peppered their front page with anti-Obama articles and released this special report on a poll revealing America's new enemy: Mainstream media.

FOX News thinks Mainstream media is America's enemy.

FOX denounces these evil media outlets as "unfair," and "biased." I'm sure many Tea-partiers wholeheartedly agree.

"Book Review: The Rise of Theodore Roosevelt"

The Rise of Theodoore Roosevelt book cover

The Rise of Theodore Roosevelt by Edmund Morris

This mountain of a biography chronicles the life of Theodore Roosevelt before he became president at the age of 42. It is inspiring, insightful, and exceedingly well documented (over 100 pages of notes).

TR was noted for his integrity, personality, and masculinity ...

"A '47%' Grip on Reality"

I still hold that Romney's "gaffe" was no more than a simple appeasement to rich Republican donors. I highly doubt that he intended to offend anyone.

But he made a mistake: he got caught on camera. And now real people are really hurt.

That matters.

Especially when you now ...

"Setting up a Django Server with Gentoo"

This is part 3 in a 3 part series I've written on setting up a Django production site on Gentoo. In the first 2 parts I went over basic boilerplate server setup, and database installation which can be on the same server or separated.