-
-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constance CLI does not work properly without django admin #498
Comments
I am running into the same thing, this is the error we are getting when trying to run Traceback (most recent call last):
File "/venv/lib/python3.10/site-packages/django/apps/registry.py", line 156, 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/src/dashboard/manage.py", line 22, in <module>
main()
File "/usr/src/dashboard/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 257, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 39, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, 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 "/venv/lib/python3.10/site-packages/constance/management/commands/constance.py", line 10, in <module>
from ...admin import ConstanceForm, get_values
File "/venv/lib/python3.10/site-packages/constance/admin.py", line 366, in <module>
admin.site.register([Config], ConstanceAdmin)
File "/venv/lib/python3.10/site-packages/django/utils/functional.py", line 246, in inner
self._setup()
File "/venv/lib/python3.10/site-packages/django/contrib/admin/sites.py", line 561, in _setup
AdminSiteClass = import_string(apps.get_app_config('admin').default_site)
File "/venv/lib/python3.10/site-packages/django/apps/registry.py", line 163, in get_app_config
raise LookupError(message)
LookupError: No installed app with label 'admin'. |
@syre @Alirezaja1384 please confirm if this issue was resolved by installing the packed from the main branch |
@camilonova I just tested it. It works completely fine. Thank you. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the problem
It seems disabling django admin's app breaks the constance CLI. As I noticed
constance/management/commands/constance.py
importsConstanceForm
andget_values
from admin configuration. The problem isadmin.py
tries to register the constance's config class and since the admin app is not present inINSTALLED_APPS
django throws aLookupError
.I think splitting
ConstanceForm
andget_values
to a separate module (likeforms.py
) and importing them directly from that module can easily fix the problem.Steps to reproduce
django.contrib.admin
fromINSTALLED_APPS
(And its URL pattern)python manage.py constance --help
System configuration
The text was updated successfully, but these errors were encountered: