octue / django-gcp

Everything required to run Django on GCP (storage, pubsub events, tasks, logging, errors)
Other
21 stars 3 forks source link

Incorrect Default App Config #23

Closed thclark closed 1 year ago

thclark commented 2 years ago

Bug report

What is the current behavior?

The default_app_config value in __init__.py is incorrecly set to django_gcp.apps.DjangoGcpAppConfig when the class name is DjangoGCPAppConfig.

This results in the following (largely confusing) error:

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 110, in inner_run
    autoreload.raise_last_exception()
  File "/usr/local/lib/python3.9/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 375, in execute
    autoreload.check_errors(django.setup)()
  File "/usr/local/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/usr/local/lib/python3.9/site-packages/django/apps/config.py", line 228, in create
    if not issubclass(app_config_class, AppConfig):
TypeError: issubclass() arg 1 must be a class

Workaround

Set the full path in your django installed apps:


INSTALLED_APPS = [
    # ...
    "django_gcp.apps.DjangoGCPAppConfig",
    # ...
]

Proposed Solution

Fix the naming.