django-components/tests/django_test_setup.py
Emil Stenström 07986c5216
Caching templates to allow for dynamic template generation
Co-authored-by: rbeard0330 <@dul2k3BKW6m>
2021-02-15 21:07:14 +01:00

24 lines
726 B
Python

import django
from django.conf import settings
if not settings.configured:
# Django 1.8 changes how you set up templates, so use different
# settings for different Django versions
if django.VERSION >= (1, 8):
settings.configure(
INSTALLED_APPS=('django_components',),
TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ["tests/templates/"],
}],
COMPONENTS={
'TEMPLATE_CACHE_SIZE': 128
},
)
else:
settings.configure(
INSTALLED_APPS=('django_components',),
TEMPLATE_DIRS=["tests/templates/"],
)
django.setup()