Exemple #1
0
def test_templates():
    from uiro import template as uiro_template
    from .pkgs import template_app

    uiro_template.setup_lookup((template_app,))
    template = uiro_template.get_app_template('template_app:test.mako')
    assert template.render(content='work') == b'No more work'
Exemple #2
0
def main(global_conf, root, **settings):
    """ Entry point to create Uiro application.

    Setup all of necessary things:

      * Getting root matching
      * Initializing DB connection
      * Initializing Template Lookups
      * Collecting installed applications
      * Creating apps for serving static files

    and will create/return Uiro application.
    """
    matching = import_module_attribute(settings["uiro.root_matching"])
    apps = [import_module(app_name) for app_name in settings["uiro.installed_apps"].split("\n") if app_name != ""]

    static_matching = get_static_app_matching(apps)
    if static_matching:
        matching = static_matching + matching

    setup_lookup(apps)
    initdb(settings)
    return make_wsgi_app(matching)