You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When I have a Django project with Dynaconf integration, I get startup errors.
I have my settings in settings.py and am using Dynaconf in Explicit Mode to merge INSTALLED_APPS from an external json file with the Django defaults in settings.py
To Reproduce
Clone the repo cd into the project dir
Create the venv (python3 -m venv venv)
Activate the venv (source venv/bin/activate)
Install dependencies (pip install -r requirements.txt)
Run the server (./manage.py runserver)
Expected behavior
To run the server without errors. The result should be that the INSTALLED_APPS from the /django_dynaconf/configs/external_settings.json should be merged with the INSTALLED_APPS setting in django_dynaconf/settings.py
Environment (please complete the following information):
OS: WSL2 Ubuntu 22.04.3
Dynaconf Version 3.2.4
Frameworks in use (Django 5.0.1 and 4.2)
Additional context
I believe I'm forced to use Explicit Mode due to the complexities of the larger project that this minimal reproduction doesn't highlight
Stack Trace
$ ./manage.py runserver
INSTALLED_APPS=['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles']
INSTALLED_APPS=['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles']
Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/apps/registry.py", line 158, in get_app_config
return self.app_configs[app_label]
KeyError: 'admin'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 133, in inner_run
self.check(display_num_errors=True)
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/core/management/base.py", line 485, in check
all_issues = checks.run_checks(
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/core/checks/urls.py", line 42, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/core/checks/urls.py", line 61, in _load_all_namespaces
url_patterns = getattr(resolver, "url_patterns", [])
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/utils/functional.py", line 47, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/urls/resolvers.py", line 735, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/utils/functional.py", line 47, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/urls/resolvers.py", line 728, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/django_dynaconf/urls.py", line 21, in <module>
path('admin/', admin.site.urls),
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/utils/functional.py", line 251, in inner
self._setup()
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/contrib/admin/sites.py", line 601, in _setup
AdminSiteClass = import_string(apps.get_app_config("admin").default_site)
File "/home/user/src/django/django_dynaconf_INSTALLED_APPS/venv/lib/python3.10/site-packages/django/apps/registry.py", line 165, in get_app_config
raise LookupError(message)
LookupError: No installed app with label 'admin'.
The text was updated successfully, but these errors were encountered:
A workaround I have is to not merge INSTALLED_APPS from external_settings.json but instead rename INSTALLED_APPS in external_settings.json to INSTALLED_APPS_TO_ADD and do this...
Describe the bug
When I have a Django project with Dynaconf integration, I get startup errors.
I have my settings in settings.py and am using Dynaconf in Explicit Mode to merge INSTALLED_APPS from an external json file with the Django defaults in settings.py
Minimal git repo reproducing the bug
To Reproduce
Clone the repo
cd
into the project dirCreate the venv (
python3 -m venv venv
)Activate the venv (
source venv/bin/activate
)Install dependencies (
pip install -r requirements.txt
)Run the server (
./manage.py runserver
)Expected behavior
To run the server without errors. The result should be that the
INSTALLED_APPS
from the/django_dynaconf/configs/external_settings.json
should be merged with theINSTALLED_APPS
setting indjango_dynaconf/settings.py
Environment (please complete the following information):
Additional context
I believe I'm forced to use Explicit Mode due to the complexities of the larger project that this minimal reproduction doesn't highlight
Stack Trace
The text was updated successfully, but these errors were encountered: