refactor: Prepare autodiscover and template loader for v1 (#533)

This commit is contained in:
Juro Oravec 2024-07-29 20:27:35 +02:00 committed by GitHub
parent b1bd430a07
commit 8cb88558f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 643 additions and 552 deletions

View file

@ -1,8 +1,16 @@
from pathlib import Path
from typing import Dict, Optional
import django
from django.conf import settings
if not settings.configured:
def setup_test_config(components: Optional[Dict] = None):
if settings.configured:
return
settings.configure(
BASE_DIR=Path(__file__).resolve().parent,
INSTALLED_APPS=("django_components",),
TEMPLATES=[
{
@ -13,7 +21,10 @@ if not settings.configured:
],
}
],
COMPONENTS={"template_cache_size": 128},
COMPONENTS={
"template_cache_size": 128,
**(components or {}),
},
MIDDLEWARE=["django_components.middleware.ComponentDependencyMiddleware"],
DATABASES={
"default": {