Yeah, I guess I'll go that route. Although it looks like the Python doc prefers socket.gethostname()
The problem I run in to is that this requires that I set /etc/hostname to "www.mysite.com", "qa.mysite.com" whereas I had understood that the hostname is typically just "www", "qa", etc. Not a big deal, I guess.