You can just read the file content and return it with an HttpResponse(), like 
this:


    # File handle
    fileHandle = None

    # Open the file, return a 404 if failed
    try:
        fileHandle = open(filePath, 'r')
    except IOError:
        raise Http404()

   # Return the file
    return HttpResponse(content=fileHandle.read(), content_type=’text/html')

François


> On Mar 16, 2015, at 8:49 AM, Guilherme Leal <lealhu...@gmail.com> wrote:
> 
> Hello!
> 
> Anyone knows a way to load a template file WITHOUT parsing/rendering it?
> 
> To ilustrate a bit more: 
> 
> I have a django app serving a restfull api, and everithing is just fine with 
> it. The front end that consumes this api, is an Angular.js single page app. 
> To centralize the routing logic, what i want to do is to let django to serve 
> the "index.html" of this app. The only problem is, when i load the html of 
> the front end (through "django.template.loader.get_template"), the template 
> engine tries to parse it, and throws an exception because this "template" has 
> the angularjs template tags on it.
> 
> What i need is:
> - Load the template without parsing/rendering it
> OR
> - Serve this html document as static in production (the static serving view 
> only works when debug is activated)
> 
> Thanx in advance!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAOs3Lp43aDqXDSfNNcH10gUvAZB-3UazGEL45bW59t-6Hyay9Q%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/FFC3A2C1-51A0-4A2D-9D94-EEF0C511C5A6%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to