angularjsdjangoherokuionic-frameworkverbatim

Django treat all templates as VERBATIM for sharing resources with ionic & web


We're building a website with an ionic app, using a django backend (django_rest_framework & traditional responsive templates) & Angular.

We'd ideally like to share the mobile templates between the ionic app and the django webserver. Our django templates are in effect static html, and I was wondering if there is a way to tell django to treat all templates (or a large subset of templates) as being {% VERBATIM %} without actually have to put {% VERBATIM %} into the templates themselves.

We'd thought about using gulp to copy the ionic templates into a django template dir and wrap each one in VERBATIM tags, but this feels clunky. Was wondering if there is a way to tell Django to not parse the templates as templates?

I'd looked at whether this could be used using the "ssi" templatetag, but as this is being deprecated in 1.9 (and we're using 1.8) I was wondering is anybody could throw some pointers at me?

Because we're running the app on heroku its not quite as simple as sticking an nginx server in front of the app to serve the templates directly...


Solution

  • If you don't need any Django template parsing at all you can place the template files under the STATIC_URL, e g at "/static/views/[template.html]".

    (at Heroku I think you need WhiteNoise for static files handling)