Example #1
0
            for filename in filter(lambda x: x.endswith(".py") or x.endswith(".pyc"), os.listdir(mod_path)):
                # Exclude __init__.py files
                if filename == "__init__.py" or filename == "__init__.pyc":
                    continue

                file_mod_path = "%s.templatetags.%s" % (app_path, filename.rsplit(".", 1)[0])
                try:
                    import_module(file_mod_path)
                except ImportError:
                    pass

    def initialize_thirdparty_templatetags(self):
        self.preload_templatetags_modules()
        library._update_env(self)

initial_params = {
    "autoescape": JINJA2_AUTOESCAPE,
    "extensions": list(set(list(JINJA2_EXTENSIONS) + DEFAULT_EXTENSIONS)),
}

initial_params.update(JINJA2_ENVIRONMENT_OPTIONS)

env = Environment(**initial_params)

# Initialize environment inline
if django.VERSION[:2] < (1, 7):
    env.initialize()

__all__ = ["env", "initialize_environment"]