Hi,
What is the best way to write a script that uses model.py to open a
connection to the db that honours the current configuration, so that I
can do some database massaging ? At the moment I do the same as the
start-* script, but I don't really need to setup any of the webserving
so I wonder if there is a cleaner way ?
import vrq.model as model
....
def main():
# .... use the model package ....
if __name__ == '__main__':
if exists(join(dirname(__file__), "setup.py")):
turbogears.update_config(configfile="devcfg.py",
modulename="vrq.config")
else:
turbogears.update_config(configfile="prodcfg.py",
modulename="vrq.config")
cherrypy.server.start(initOnly=True,serverClass=None)
main()
-Drew