#!/usr/bin/env python
import sys
from django.template.loader import add_to_builtins
from django.template import Template, Context
from django.conf import settings

settings.configure()
settings.TEMPLATE_DIRS = ['.']

add_to_builtins('django.template.loader_tags')

def render(filename):
    with open(filename) as f:
        html = f.read()
        template = Template(html)
        context = Context()
        return template.render(context)

def main():
    try:
        filename = sys.argv[1]
    except IndexError:
        sys.exit('Please provide template fil path as argument, usage:\n\n\t$ firedj index.html\n')

    print render(filename)


if __name__ == '__main__':
    main()

@@ -26,16 +26,31 @@
 ort sys%0A
+import os.path%0A
 from dja
@@ -176,108 +176,8 @@
 gs%0A%0A
-settings.configure()%0Asettings.TEMPLATE_DIRS = %5B'.'%5D%0A%0Aadd_to_builtins('django.template.loader_tags')%0A
 %0Adef
@@ -528,16 +528,189 @@
 ml%5Cn')%0A%0A
+    curdir = os.path.dirname(os.path.abspath(filename))%0A%0A    settings.configure()%0A    settings.TEMPLATE_DIRS = %5Bcurdir%5D%0A%0A    add_to_builtins('django.template.loader_tags')%0A%0A
     prin

add current directory to TEMPLATE_DIRS