• Stars
    star
    116
  • Rank 303,894 (Top 6 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created about 15 years ago
  • Updated over 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A readline shell for the Django template language.
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 %}
    FOO
    >>>

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
    Out[0]:
    ['app_path',
     'error_message',
     'root_path',
     'title',
     'MEDIA_URL',
     'LANGUAGES',
     'LANGUAGE_BIDI',
     'LANGUAGE_CODE',
     'perms',
     'messages',
     'user']
    ipdb> print user
    AnonymousUser

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 %}

More Repositories

1

django-phased

Simple two-phase template rendering application useful for caching of authenticated requests
Python
118
star
2

django-socketio-example

an example of using Django with Socket.IO
Python
76
star
3

surlex

Surlex (Simple URL expression translator) - Language for URL matching and extraction
Python
72
star
4

yoloimport

Never see another ImportError
Python
63
star
5

django-qunit

django-qunit integrates the QUnit Javascript testing framework with Django.
JavaScript
54
star
6

django-smart-load-tag

An attempt to bring namespaces and more control to Django's {% load %} tag.
Python
49
star
7

django-inmemorystorage

A non-persistent in-memory data storage backend for Django.
Python
32
star
8

gevent-spider

A simple spider with a realtime web UI.
Python
28
star
9

pieshop

a Javascript client for RESTful APIs targeting django-tastypie
JavaScript
24
star
10

ven

Virtualenv management refined
Shell
13
star
11

lawrence-veggie

List of vegetarian/vegan restaurants in Lawrence, KS
9
star
12

snowman

2010 Django Dash entry
Python
8
star
13

butlertron

an IRC bot
Python
8
star
14

pyraid

python-fuse raid implementation useful for data recovery
Python
5
star
15

python-memcached

fork of python-memcached from http://www.tummy.com/Community/software/python-memcached/ original project does not updates
Python
3
star
16

gohttpbin

Go implementation of httpbin.org
Go
2
star
17

paint

Gevent-socketio example app (collaborative painting)
JavaScript
1
star
18

django-grappelli

Unofficial mirror of django-grappelli's Google Code SVN repository
JavaScript
1
star
19

commandq

Create simple command queue invoker/worker processes with UNIX pipes and file locks.
Python
1
star
20

django-gis-bug-example

Just here to demonstrate a bug. Move along please.
Python
1
star