I'm very new to Django and I'm trying to set up a new project, using django-configurations to manage the config of Development, Staging and Production environments.https://pypi.org/project/django-configurations/
I followed the quickstart guide, but after setting things up I keep getting this error when running manage.py runserver
:
File "[path_redacted]/django_test/.venv/lib/python3.11/site-packages/django/apps/registry.py", line 165, in get_app_config raise LookupError(message)LookupError: No installed app with label 'admin'.
This is a brand new blank project, no apps and no changes whatsoever from the default project setup. I only set up django-configurations as per the quickstart guide.
I have manage.py
set up as per the guide:
#!/usr/bin/env python"""Django's command-line utility for administrative tasks."""import osimport sysdef main():"""Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_test.settings') os.environ.setdefault('DJANGO_CONFIGURATION', 'Development') try: from configurations.management import execute_from_command_line except ImportError as exc: raise ImportError("Couldn't import Django. Are you sure it's installed and ""available on your PYTHONPATH environment variable? Did you ""forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv)if __name__ == '__main__': main()
Then do the same with settings.py
, by adding the below class just after the default definition of BASE_DIR
:
class Development(Configuration): DEBUG = True
The default installed apps are there and untouched, including the admin app:
INSTALLED_APPS = ['django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles',]
If I comment out the default admin path in urls.py
then manage.py runserver
works fine, but then of course I have no access to the admin page.
urlpatterns = [ # path('admin/', admin.site.urls),]
I feel like I'm missing something very obvious here, but I just can't figure out what.