完整报错如下:
Internal Server Error: /accounts/login/
Traceback (most recent call last):
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.7/contextlib.py", line 74, in inner
return func(*args, **kwds)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/views/generic/base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/views.py", line 127, in post
return self.validate_registration_form()
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/views.py", line 214, in validate_registration_form
self.register_user(form)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/mixins.py", line 56, in register_user
self.send_registration_email(user)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/mixins.py", line 93, in send_registration_email
Dispatcher().dispatch_user_messages(user, messages)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/utils.py", line 59, in dispatch_user_messages
dispatched_messages['email'] = self.send_user_email_messages(user, messages)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/utils.py", line 94, in send_user_email_messages
email = self.send_email_messages(user.email, messages)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/utils.py", line 123, in send_email_messages
email.send()
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/core/mail/message.py", line 291, in send
return self.get_connection(fail_silently).send_messages([self])
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/core/mail/message.py", line 248, in get_connection
self.connection = get_connection(fail_silently=fail_silently)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/core/mail/__init__.py", line 34, in get_connection
klass = import_string(backend or settings.EMAIL_BACKEND)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_mailgun'
[06/Mar/2020 20:27:05] "POST /accounts/login/ HTTP/1.1" 500 157348
这里检查一下:
app_label= auth
Internal Server Error: /accounts/login/
Traceback (most recent call last):
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.7/contextlib.py", line 74, in inner
return func(*args, **kwds)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/views/generic/base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/views.py", line 127, in post
return self.validate_registration_form()
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/views.py", line 214, in validate_registration_form
self.register_user(form)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/mixins.py", line 56, in register_user
self.send_registration_email(user)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/mixins.py", line 93, in send_registration_email
Dispatcher().dispatch_user_messages(user, messages)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/utils.py", line 59, in dispatch_user_messages
dispatched_messages['email'] = self.send_user_email_messages(user, messages)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/utils.py", line 94, in send_user_email_messages
email = self.send_email_messages(user.email, messages)
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/oscar/apps/customer/utils.py", line 123, in send_email_messages
email.send()
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django/core/mail/message.py", line 291, in send
return self.get_connection(fail_silently).send_messages([self])
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django_mailgun.py", line 177, in send_messages
if self._send(message):
File "/home/appleyuchi/.virtualenvs/python3.7/lib/python3.7/site-packages/django_mailgun.py", line 163, in _send
raise MailgunAPIError(response)
django_mailgun.MailgunAPIError: <Response [401]>
[06/Mar/2020 20:27:33] "POST /accounts/login/ HTTP/1.1" 500 145293
根据[1]:
This project is unsupported.
弃坑吧,settings.py中更换邮件引擎.
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
DEFAULT_FROM_EMAIL='753743312@qq.com'
SQLALCHEMY_TRACK_MODIFICATIONS= False
EMAIL_HOST ='smtp.qq.com'
EMAIL_SUPPRESS_SEND= False # 发送邮件,为True则不发送
EMAIL_PORT = 587#SSL协议端口号
EMAIL_USE_SSL= False # 重要,qq邮箱需要使用SSL
EMAIL_USE_TLS= True # 不需要使用TLS
EMAIL_HOST_USER= 'xxxxxxxxxx@qq.com'
EMAIL_HOST_PASSWORD ='xxxxxxxxxxxx'#授权码,不是密码
SECURITY_EMAIL_SENDER= 'no-reply@localhost'
Reference:
[1]https://github.com/BradWhittington/django-mailgun/issues/34
来源:CSDN
作者:东方朔盗仙桃
链接:https://blog.csdn.net/appleyuchi/article/details/104703655