Exemple #1
0
def from_file(file):
    """
    Custom argument parser type for configuration files.
    Reads configuration file and initializes dependent utilities
    """
    config = configparser.SafeConfigParser()
    config.read(file)

    try:
        # setup logging (this is optional)
        logging.config.fileConfig(file)
    except configparser.NoSectionError:
        pass

    settings = dict(config.items('settings'))

    # Database
    Session.configure(bind=engine_from_config(settings))

    # Email
    turbomail.interface.start(settings)

    return settings
Exemple #2
0
def setup_module():
    engine = create_engine('sqlite://')
    models.Base.metadata.create_all(bind=engine)
    Session.configure(bind=engine)