Skip to content

Instantly share code, notes, and snippets.

@derks
Last active August 29, 2015 14:01
Show Gist options
  • Save derks/1a359db6514308d16644 to your computer and use it in GitHub Desktop.
Save derks/1a359db6514308d16644 to your computer and use it in GitHub Desktop.
from cement.core import hook
def add_db_object(app):
# setup your database object here, note you can
# get database config settings from app.config.get()
my_db_object = WhateverYourDatabaseIs()
app.extend('db', my_db_object)
hook.register('pre_run', add_db_object)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment