mirror of
https://github.com/django-components/django-components.git
synced 2025-09-24 22:52:28 +00:00
feat: add JS dependency manager (#666)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
0026fa4a44
commit
849a869a66
31 changed files with 1730 additions and 19 deletions
|
@ -5,14 +5,17 @@ import django
|
|||
from django.conf import settings
|
||||
|
||||
|
||||
def setup_test_config(components: Optional[Dict] = None):
|
||||
def setup_test_config(
|
||||
components: Optional[Dict] = None,
|
||||
extra_settings: Optional[Dict] = None,
|
||||
):
|
||||
if settings.configured:
|
||||
return
|
||||
|
||||
settings.configure(
|
||||
BASE_DIR=Path(__file__).resolve().parent,
|
||||
INSTALLED_APPS=("django_components", "tests.test_app"),
|
||||
TEMPLATES=[
|
||||
default_settings = {
|
||||
"BASE_DIR": Path(__file__).resolve().parent,
|
||||
"INSTALLED_APPS": ("django_components", "tests.test_app"),
|
||||
"TEMPLATES": [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [
|
||||
|
@ -21,18 +24,25 @@ def setup_test_config(components: Optional[Dict] = None):
|
|||
],
|
||||
}
|
||||
],
|
||||
COMPONENTS={
|
||||
"COMPONENTS": {
|
||||
"template_cache_size": 128,
|
||||
**(components or {}),
|
||||
},
|
||||
MIDDLEWARE=["django_components.middleware.ComponentDependencyMiddleware"],
|
||||
DATABASES={
|
||||
"MIDDLEWARE": ["django_components.middleware.ComponentDependencyMiddleware"],
|
||||
"DATABASES": {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": ":memory:",
|
||||
}
|
||||
},
|
||||
SECRET_KEY="secret",
|
||||
"SECRET_KEY": "secret",
|
||||
}
|
||||
|
||||
settings.configure(
|
||||
**{
|
||||
**default_settings,
|
||||
**(extra_settings or {}),
|
||||
}
|
||||
)
|
||||
|
||||
django.setup()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue