Given a string with a module name, how do you import everything in the module as if you had called:
from module import *
i.e. given string
I didn't find a good way to do it so I took a simpler but ugly way from http://www.djangosnippets.org/snippets/600/
try: import socket hostname = socket.gethostname().replace('.','_') exec "from host_settings.%s import *" % hostname except ImportError, e: raise e