Hello @kartik,
Let's say you have this important template tag in the module read.py
from django import template
register = template.Library()
@register.filter(name='bracewrap')
def bracewrap(value):
return "{" + value + "}"
This is the html template file "temp.html":
{{var|bracewrap}}
Finally, here is a Python script that will tie to all together
import django
from django.conf import settings
from django.template import Template, Context
import os
#load your tags
from django.template.loader import get_template
django.template.base.add_to_builtins("read")
# You need to configure Django a bit
settings.configure(
TEMPLATE_DIRS=(os.path.dirname(os.path.realpath(__file__)), ),
)
#or it could be in python
#t = Template('My name is {{ my_name }}.')
c = Context({'var': 'edureka.co'})
template = get_template("temp.html")
# Prepare context ....
print template.render(c)
The output would be
{edureka.co}
Hope it helps!!