asphalt.templating.renderers.django

class asphalt.templating.renderers.django.DjangoRenderer(engine=None, package_paths=())

Renders Django templates.

Parameters:
  • engine – a Django template engine object or keyword arguments for its constructor

  • package_paths – if given, looks up the directories containing the given package and fills in or extends the dirs argument for Engine. The value will be interpreted by package_to_directory().

render(template, **vars)

Render the named template.

Parameters:
  • template (str) – name of the template file, relative to any of the configured template directories

  • vars (Any) – extra context variables made available to templates

Return type:

str

Returns:

the rendered results

render_string(source, **vars)

Render the template contained in the given string.

Parameters:
  • source (str) – content of the template to render

  • vars (Any) – extra variables made available to the template

Return type:

str

Returns:

the rendered results