Replies: 2 comments 1 reply
-
I think I may have found a solution (or at least a decent hack). I have some post-processing shell scripts that I use to do things like install software into my environment, create databases, etc.
This tells cookiecutter to just copy the templates without editing them.
then I can write my templates "normally" (without
and just let find + sed take care of the substitution in my template directory. |
Beta Was this translation helpful? Give feedback.
-
There may be better solutions! (But I have not tried them yet.) Apparently you can override the markers that identify Jinja blocks and variables. This post suggests that you can put a special header in your files that looks like this:
which will allow you to use different characters to mark Jinja "stuff" -- that might avoid having the Jinja preprocessor clash with the Django Template Language processor. If you do a web search for "jinja variable_start_string", it appears there is a way to set this in the Jinja environment, but I don't have the first clue about how to do that. |
Beta Was this translation helpful? Give feedback.
-
I've seen some hints (e.g.
{% raw %} / {% endraw %}
and putting a_copy_without_render
in my cookiecutter.json file...but they seem unsatisfying.I'd like to do something like this:
But my "extends" (which is supposed to be the Django Template Language - DTL) conflicts with Jinja2's "extends"
on a related note:
seems to blow up because Jinja2 doesn't have a
{% url %}
tag.Is there a pattern here that I'm missing?
Beta Was this translation helpful? Give feedback.
All reactions