Hi,
I would like to add new accounts only manually, the mailman3 site should not be open for sign-ups. So I've added this code to settings.py:
--8<---------------cut here---------------start------------->8--- from allauth.account.adapter import DefaultAccountAdapter
class MyAccountAdapter(DefaultAccountAdapter): def is_open_for_signup(self, request): return False
ACCOUNT_ADAPTER = 'MyAccountAdapter' --8<---------------cut here---------------end--------------->8---
It seems to work, but the user experience is not optimal: the user can click on "Sign Up", and then gets to "Server Error (500)". This is the log:
--8<---------------cut here---------------start------------->8--- ERROR 2018-01-31 21:53:47,116 6769 django.request Internal Server Error: /accounts/signup/ Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, **kwargs) File "/usr/lib/python2.7/site-packages/django/utils/decorators.py", line 34, in _wrapper return bound_func(*args, **kwargs) File "/usr/lib/python2.7/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper return view(request, *args, **kwargs) File "/usr/lib/python2.7/site-packages/django/utils/decorators.py", line 30, in bound_func return func.__get__(self, type(self))(*args2, **kwargs2) File "/usr/lib/python2.7/site-packages/django_allauth-0.34.0-py2.7.egg/allauth/account/views.py", line 210, in dispatch return super(SignupView, self).dispatch(request, *args, **kwargs) File "/usr/lib/python2.7/site-packages/django_allauth-0.34.0-py2.7.egg/allauth/account/views.py", line 79, in dispatch **kwargs) File "/usr/lib/python2.7/site-packages/django_allauth-0.34.0-py2.7.egg/allauth/account/views.py", line 182, in dispatch if not self.is_open(): File "/usr/lib/python2.7/site-packages/django_allauth-0.34.0-py2.7.egg/allauth/account/views.py", line 191, in is_open return get_adapter(self.request).is_open_for_signup(self.request) File "/usr/lib/python2.7/site-packages/django_allauth-0.34.0-py2.7.egg/allauth/account/adapter.py", line 501, in get_adapter return import_attribute(app_settings.ADAPTER)(request) File "/usr/lib/python2.7/site-packages/django_allauth-0.34.0-py2.7.egg/allauth/utils.py", line 150, in import_attribute pkg, attr = path.rsplit('.', 1) ValueError: need more than 1 value to unpack ERROR 2018-01-31 21:53:47,116 6769 django.request Internal Server Error: /accounts/signup/ Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, **kwargs) File "/usr/lib/python2.7/site-packages/django/utils/decorators.py", line 34, in _wrapper return bound_func(*args, **kwargs) File "/usr/lib/python2.7/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper return view(request, *args, **kwargs) File "/usr/lib/python2.7/site-packages/django/utils/decorators.py", line 30, in bound_func return func.__get__(self, type(self))(*args2, **kwargs2) File "/usr/lib/python2.7/site-packages/django_allauth-0.34.0-py2.7.egg/allauth/account/views.py", line 210, in dispatch return super(SignupView, self).dispatch(request, *args, **kwargs) File "/usr/lib/python2.7/site-packages/django_allauth-0.34.0-py2.7.egg/allauth/account/views.py", line 79, in dispatch **kwargs) File "/usr/lib/python2.7/site-packages/django_allauth-0.34.0-py2.7.egg/allauth/account/views.py", line 182, in dispatch if not self.is_open(): File "/usr/lib/python2.7/site-packages/django_allauth-0.34.0-py2.7.egg/allauth/account/views.py", line 191, in is_open return get_adapter(self.request).is_open_for_signup(self.request) File "/usr/lib/python2.7/site-packages/django_allauth-0.34.0-py2.7.egg/allauth/account/adapter.py", line 501, in get_adapter return import_attribute(app_settings.ADAPTER)(request) File "/usr/lib/python2.7/site-packages/django_allauth-0.34.0-py2.7.egg/allauth/utils.py", line 150, in import_attribute pkg, attr = path.rsplit('.', 1) ValueError: need more than 1 value to unpack --8<---------------cut here---------------end--------------->8---
Do you have any hints, how to avoid such errors please?
TIA for any help,
Peter