django-components/tests/django_test_setup.py
Juro Oravec 37fd901908
Resolve media and template files relative to component class dir (#395), thanks @JuroOravec
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Emil Stenström <emil@emilstenstrom.se>
2024-03-23 19:01:39 +01:00

26 lines
781 B
Python

import django
from django.conf import settings
if not settings.configured:
settings.configure(
INSTALLED_APPS=("django_components",),
TEMPLATES=[
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
"tests/templates/",
"tests/components/", # Required for template relative imports in tests
],
}
],
COMPONENTS={"template_cache_size": 128},
MIDDLEWARE=["django_components.middleware.ComponentDependencyMiddleware"],
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
},
)
django.setup()