Django with PostgreSQL on Mac OS X Leopard

Previously, I discussed the steps I went through to get PostgreSQL working on Tiger. This weekend I upgraded my system to a new MacBook Pro running Leopard. PPC -> x86 Although the Migration Assistant copied the version of PostgreSQL I had previously installed to the new machine, the results didn’t work because the service would not start correctly. I ended up reinstalling using the Unified Installer from PostgreSQL for Mac, and the server still wouldn’t start.

PyMOTW: hashlib

The hashlib module deprecates the separate md5 and sha modules and makes their API consistent. To work with a specific hash algorithm, use the appropriate constructor function to create a hash object. Then you can use the same API to interact with the hash no matter what algorithm is being used. Read more at pymotw.com: hashlib

Python development tools you can’t live without

I’m working on a series of columns for Python Magazine in which I will be talking about development tools. The first “episode” appears in the January 2008 issue and covers testing tools like frameworks and runners. I have several more columns plotted out, but want to make sure I cover the topics well and don’t miss out on mentioning a new or small tool just because I haven’t heard about it myself.

PyMOTW: threading

The threading module lets you run multiple operations concurrently in the same process space. Read more at pymotw.com: threading

January PyATL Meetup

This past Thursday I made it back to another PyATL meeting to see presentations on packaging and build tools for Python. Brandon Rhodes started us out with a bit of background material on how Python searches for importable modules and where they are usually installed. Jeremy Jones talked about using setuptools and building eggs. I usually distribute my packages as source, but the --tag-svn-revision option looks pretty handy for building dev releases.

PyMOTW: weakref

The weakref module lets you refer to an object without preventing it from being garbage collected. Read more at pymotw.com: weakref

import export

Glyph Lefkowitz has an interesting idea on his blog with a module for managing symbols exported publicly from your code. What he has looks like it needs to be called directly, but at least the explicitly() function could probably be implemented as a decorator and become very handy. No more forgetting to modify __all__ when you add a symbol, just decorate it as exported.

Testing Tools for Python

Test Driven Development and Test Automation are all the rage, and Python developers have no shortage of tools for testing their own applications.

Django with PostgreSQL on Mac OS X Tiger

Most of the time, when I have worked on django projects, I’ve used the SQLite backend for development on my PowerBook and deployed to PostgreSQL on my Linux server. For the project I’m working on right now, though, that turned into an issue when some of the queries that ran fine on my dev system didn’t work at all on the production box. Apparently the backend code responsible for assembling the SQL query strings was producing different text for SQLite and PostgreSQL.

PyMOTW: mmap

Use the mmap() function to create a memory-mapped file. There are differences in the arguments and behaviors for mmap() between Unix and Windows, which are not discussed below. For more details, refer to the library documentation. Read more at pymotw.com: mmap