Configure django to use both our template and pages folder as locations to look for included templates.
(self)
| 132 | |
| 133 | |
| 134 | def setup(self): |
| 135 | """ |
| 136 | Configure django to use both our template and pages folder as locations |
| 137 | to look for included templates. |
| 138 | """ |
| 139 | |
| 140 | settings = { |
| 141 | "TEMPLATE_DIRS": [self.template_path, self.page_path], |
| 142 | "INSTALLED_APPS": ['django_markwhat'], |
| 143 | } |
| 144 | |
| 145 | if self.locale is not None: |
| 146 | settings.update({ |
| 147 | "USE_I18N": True, |
| 148 | "USE_L10N": False, |
| 149 | "LANGUAGE_CODE": self.locale, |
| 150 | "LOCALE_PATHS": [self.locale_path], |
| 151 | }) |
| 152 | |
| 153 | django.conf.settings.configure(**settings) |
| 154 | |
| 155 | # - Importing here instead of the top-level makes it work on Python 3.x (!) |
| 156 | # - loading add_to_builtins from loader implictly loads the loader_tags built-in |
| 157 | # - Injecting our tags using add_to_builtins ensures that Cactus tags don't require an import |
| 158 | from django.template.loader import add_to_builtins |
| 159 | add_to_builtins('cactus.template_tags') |
| 160 | |
| 161 | def verify_path(self): |
| 162 | """ |