Skip to content

Including anymail.urls appears to require unconfigured backends #103

@saschwarz

Description

@saschwarz

Just switching from SendGrid v3 API to Anymail and when I added the webhook path to my project's urls.py:

urlpatterns = [
    path('api/v1/', include(router.urls)),
    path('mail_webhook/', include('anymail.urls')),
]

I get a traceback stating that I need boto for the Amazon backend.

  • Anymail version
    3.5.1

  • ESP (Mailgun, SendGrid, etc.)
    SendGrid

  • Versions of Django, requests, python
    2.0, ?, 3.6.3

  • Exact error message and/or stack trace

$ python ./manage.py migrate
Traceback (most recent call last):
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\anymail\backends\amazon_ses.py", line 13, in <module>
    import boto3
ModuleNotFoundError: No module named 'boto3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\core\management\__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\core\management\base.py", line 332, in execute
    self.check()
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\core\management\base.py", line 364, in check
    include_deployment_checks=include_deployment_checks,
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\core\management\commands\migrate.py", line 58, in _run_checks
    issues.extend(super()._run_checks(**kwargs))
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\core\management\base.py", line 351, in _run_checks
    return checks.run_checks(**kwargs)
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\core\checks\registry.py", line 73, in run_checks
    new_errors = check(app_configs=app_configs)
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
    return check_method()
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\urls\resolvers.py", line 397, in check
    for pattern in self.url_patterns:
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\utils\functional.py", line 36, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\urls\resolvers.py", line 536, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\utils\functional.py", line 36, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\urls\resolvers.py", line 529, in urlconf_module
    return import_module(self.urlconf_name)
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Me\source\repos\s1\Notification\notification\notification\urls.py", line 34, in <module>
    path('mail_webhook/', include('anymail.urls')),
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\django\urls\conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\anymail\urls.py", line 3, in <module>
    from .webhooks.amazon_ses import AmazonSESInboundWebhookView, AmazonSESTrackingWebhookView
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\anymail\webhooks\amazon_ses.py", line 9, in <module>
    from ..backends.amazon_ses import _get_anymail_boto3_params
  File "C:\Users\Me\.virtualenvs\notification-TRTs0IXw\lib\site-packages\anymail\backends\amazon_ses.py", line 17, in <module>
    raise AnymailImproperlyInstalled(missing_package='boto3', backend='amazon_ses')
anymail.exceptions.AnymailImproperlyInstalled: The boto3 package is required to use this backend, but isn't installed.
(Be sure to use `pip install django-anymail[amazon_ses]` with your desired backends)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions