Skip to content
This repository was archived by the owner on Jul 16, 2021. It is now read-only.
This repository was archived by the owner on Jul 16, 2021. It is now read-only.

Exception "KeyError: 'user'" thrown on startup #105

@gregbrowndev

Description

@gregbrowndev

I'm trying to deploy the app locally but I am greeted by the error below when Django starts up:

$ docker-compose run app ./manage.py createsuperuser

Starting bookshelf_ws_1 ... done
Starting bookshelf_db_1 ... done
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 79, in execute
    return super().execute(*args, **options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 366, in execute
    self.check()
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 392, in check
    all_issues = self._run_checks(
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 382, in _run_checks
    return checks.run_checks(**kwargs)
  File "/usr/local/lib/python3.8/site-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/usr/local/lib/python3.8/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
    all_namespaces = _load_all_namespaces(resolver)
  File "/usr/local/lib/python3.8/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
    url_patterns = getattr(resolver, 'url_patterns', [])
  File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.8/site-packages/django/urls/resolvers.py", line 588, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python3.8/site-packages/django/urls/resolvers.py", line 581, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/app/bookshelf/urls.py", line 11, in <module>
    from bookshelf import views
  File "/app/bookshelf/views/__init__.py", line 2, in <module>
    from .category_detail import CategoryDetailView
  File "/app/bookshelf/views/category_detail.py", line 4, in <module>
    from bookshelf.repositories import load_category
  File "/app/bookshelf/repositories/__init__.py", line 5, in <module>
    from .notification import create_notifications
  File "/app/bookshelf/repositories/notification.py", line 5, in <module>
    from .profile import config as profile_config
  File "/app/bookshelf/repositories/profile.py", line 20, in <module>
    mapper = Mapper(Profile, models.Profile, config,)
  File "/usr/local/lib/python3.8/site-packages/_mappers/factory.py", line 16, in mapper_factory
    iterable = _configure(entity, data_source, config)
  File "/usr/local/lib/python3.8/site-packages/_mappers/factory.py", line 54, in _configure
    mapping = _validate(dict(fields), data_source_fields, config, data_source)
  File "/usr/local/lib/python3.8/site-packages/_mappers/validation.py", line 15, in _validate
    _related_config_fields(data_source_fields, config)
  File "/usr/local/lib/python3.8/site-packages/_mappers/validation.py", line 98, in _related_config_fields
    _related_field_link(link_to[related])
KeyError: 'user'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions