def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    initialize_sql(engine)
    config = Configurator(settings=settings)

#    config.add_subscriber('pyramidchameleoni18n.subscribers.add_renderer_globals',
#                          'pyramid.events.BeforeRender')
#    config.add_subscriber('pyramidchameleoni18n.subscribers.add_localizer',
#                          'pyramid.events.NewRequest')
    
    config.add_translation_dirs('pyramidchameleoni18n:locale')
    config.add_static_view('static', 'pyramidchameleoni18n:static', cache_max_age=3600)
    config.add_route('home', '/')
    config.add_view('pyramidchameleoni18n.views.my_view',
                    route_name='home',
                    renderer='templates/mytemplate.pt')

    config.add_route('test_i18n', '/test')
    config.add_view('pyramidchameleoni18n.views.test_i18n_view',
                    route_name='test_i18n',
                    renderer='templates/test_i18n.pt')

    return config.make_wsgi_app()
def _initTestingDB():
    from sqlalchemy import create_engine
    from pyramidchameleoni18n.models import initialize_sql
    session = initialize_sql(create_engine('sqlite://'))
    return session