Make getEngine more like a singleton factory

I added a global var called ENGINE and if it's None, then I create
the engine from the information in the configuration. If it already
exists, then I use the one already existing.