mirror of
https://github.com/django-components/django-components.git
synced 2025-09-24 22:52:28 +00:00
refactor: Prepare autodiscover and template loader for v1 (#533)
This commit is contained in:
parent
b1bd430a07
commit
8cb88558f0
32 changed files with 643 additions and 552 deletions
|
@ -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": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue