A readline shell for the Django template language.
Latest commit 2d740a2 Mar 20, 2013 Cody Soyland Python 3 compatibility!
Failed to load latest commit information.
src/template_repl Python 3 compatibility! Mar 20, 2013
LICENSE First commit, woo hoo! Dec 10, 2009
runtests.py Add test suite runner, fix issue with Django 1.5. (True, False and No… Mar 19, 2013
setup.py Bump to 0.3.0. Feb 18, 2010


django-template-repl is a readline shell for the Django template language.
It is similar to a CPython shell but it interprets template code instead of
Python. It can be invoked either as a management command or with a templatetag.

To install, add 'template_repl' to your settings.INSTALLED_APPS.

The management command gives you quick access to the shell:
    python manage.py templateshell

You can pass a url to the management command to assume the context of a specific location:
    python manage.py templateshell -u /admin/foo/bar/

You can also provide context directly with a command line option. Here is
an example of an interactive session:
    $ python manage.py templateshell -c "{'foo': 'FOO', 'bar': True}"
    >>> {% if bar %}
    ... {{ foo }}
    ... {% endif %}

The templateshell management command also has a --pdb option to allow you to load
the context into a namespace and start a PDB debugger shell. This works in conjunction
with the -u (--url) and -c (--context) commands. It also provides a "vars" list that
shows the names of the context variables:
    $ python manage.py templateshell -u /admin/ --pdb
    ipdb> vars
    ipdb> print user

In addition, you can use the repl templatetag which creates a REPL that assumes the
context of the caller template. This is basically "PDB for templates":
    {% load repl %}{% repl %}

You can also start a real PDB shell using the same tag by giving it a second argument
of "pdb". This loads the contex into the PDB namespace:
    {% load repl %}{% repl pdb %}