I'm now working on deploying openEdx system and encounter an error while logging in via Azure AD from the mobile device.
The web Azure AD login is working fine and I can also get access_token from azure ad.
But, when I try to exchange azure token with openEdx token via /oauth2/exchange_access_token/azuread-oauth2/ url, I'm getting the following error due to the empty response.
AttributeError: 'NoneType' object has no attribute 'get'
Hence I'm fairly new to the openEdx, I have a hard time figuring out to fix the issue. Please help to direct me into the right path to fixing this issue. Following is the detail error log.
Thanks in advance
Apr 1 12:38:45 edxapp [service_variant=lms][django.request][env:sandbox] ERROR [edxapp 24509] [exception.py:135] - Internal Server Error: /oauth2/exchange_access_token/azuread-oauth2/
Traceback (most recent call last):
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
response = self._get_response(request)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 185, in inner
return func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/oauth_dispatch/views.py", line 57, in dispatch
return view(request, *args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/social_django/utils.py", line 49, in wrapper
return func(request, backend, *args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/auth_exchange/views.py", line 44, in dispatch
return super(AccessTokenExchangeBase, self).dispatch(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/views.py", line 489, in dispatch
response = self.handle_exception(exc)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/views.py", line 449, in handle_exception
self.raise_uncaught_exception(exc)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/views.py", line 486, in dispatch
response = handler(request, *args, **kwargs)
File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/auth_exchange/views.py", line 57, in post
if not form.is_valid():
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/forms/forms.py", line 183, in is_valid
return self.is_bound and not self.errors
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/forms/forms.py", line 175, in errors
self.full_clean()
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/forms/forms.py", line 385, in full_clean
self._clean_form()
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/provider/forms.py", line 63, in _clean_form
super(OAuthForm, self)._clean_form()
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/forms/forms.py", line 412, in _clean_form
cleaned_data = self.clean()
File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/auth_exchange/forms.py", line 95, in clean
user = backend.do_auth(access_token, allow_inactive_user=True)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/social_core/utils.py", line 252, in wrapper
return func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/social_core/backends/oauth.py", line 410, in do_auth
data = self.user_data(access_token, *args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/social_core/backends/azuread.py", line 80, in user_data
id_token = response.get('id_token')
AttributeError: 'NoneType' object has no attribute 'get'
social-core is throwing the error because the response is NoneType. It makes sense that social-core is responsible here as you are aiming for 3rd party oAuth2.
If it works on web, then the None response is explainable only if the configuration is wrong.
Now, steps to troubleshoot:
Check edx.properties to ensure that the config directory is properly set.
Check your config and local yamls to ensure that oauth config is proper. [instead of simply configuring ios.yaml]
Make sure you followed additional instructions provided here.
If nothing else works, check the config for social-auth as stated here.
Hope that helps! Cheers!
Related
I'm running:
Python 3.7.3
Django 3.1.14
social-auth-app-django 3.1.0
When I try to upgrade social-auth-app-django to 3.3.0 or 3.4.0, I get:
Traceback (most recent call last):
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/social_django/utils.py", line 49, in wrapper
return func(request, backend, *args, **kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/social_django/views.py", line 33, in complete
*args, **kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/social_core/actions.py", line 45, in do_complete
user = backend.complete(user=user, *args, **kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/social_core/backends/base.py", line 40, in complete
return self.auth_complete(*args, **kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/social_core/utils.py", line 247, in wrapper
return func(*args, **kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/social_core/backends/oauth.py", line 181, in auth_complete
return self.do_auth(access_token, *args, **kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/social_core/utils.py", line 247, in wrapper
return func(*args, **kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/social_core/backends/oauth.py", line 192, in do_auth
return self.strategy.authenticate(*args, **kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/social_django/strategy.py", line 107, in authenticate
return authenticate(*args, **kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/django/contrib/auth/__init__.py", line 73, in authenticate
user = backend.authenticate(request, **credentials)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/social_core/backends/base.py", line 80, in authenticate
return self.pipeline(pipeline, *args, **kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/social_core/backends/base.py", line 83, in pipeline
out = self.run_pipeline(pipeline, pipeline_index, *args, **kwargs)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/social_core/backends/base.py", line 113, in run_pipeline
result = func(*args, **out) or {}
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/social_core/pipeline/user.py", line 119, in user_details
setattr(user, name, value)
File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 547, in __set__
% self._get_set_deprecation_msg_params(),
Exception Type: TypeError at /oauth/complete/mediawiki/
Exception Value: Direct assignment to the forward side of a many-to-many set is prohibited. Use groups.set() instead.
when I try to authenticate. Any idea what's going on?
The TL;DR is to add
SOCIAL_AUTH_PROTECTED_USER_FIELDS = ['groups']
to settings.py. See here for the longer version.
I have the following in adapter.py:
from allauth.account.adapter import DefaultAccountAdapter
class CustomAllauthAdapter(DefaultAccountAdapter):
pass # keeping it trivial for debugging
At the very bottom of settings.py:
import django
django.setup() # complains about apps not being loaded yet without this...
from .adapter import CustomAllauthAdapter
ACCOUNT_ADAPTER = CustomAllauthAdapter # this is the line that results in the error!
As soon as I submit the registration form for a new user, I get this error in the browser:
AssertionError at /api/v1/users/auth/register/
No exception message supplied
Here is the Traceback:
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\django\views\generic\base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\django\utils\decorators.py", line 43, in _wrapper
return bound_method(*args, **kwargs)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\django\views\decorators\debug.py", line 89, in sensitive_post_parameters_wrapper
return view(request, *args, **kwargs)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\dj_rest_auth\registration\views.py", line 47, in dispatch
return super().dispatch(*args, **kwargs)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\rest_framework\views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\rest_framework\views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception
raise exc
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\rest_framework\views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\rest_framework\generics.py", line 190, in post
return self.create(request, *args, **kwargs)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\dj_rest_auth\registration\views.py", line 66, in create
serializer.is_valid(raise_exception=True)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\rest_framework\serializers.py", line 220, in is_valid
self._validated_data = self.run_validation(self.initial_data)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\rest_framework\serializers.py", line 419, in run_validation
value = self.to_internal_value(data)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\rest_framework\serializers.py", line 478, in to_internal_value
validated_value = validate_method(validated_value)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\dj_rest_auth\registration\serializers.py", line 209, in validate_email
email = get_adapter().clean_email(email)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\allauth\account\adapter.py", line 535, in get_adapter
return import_attribute(app_settings.ADAPTER)(request)
File "C:\Dropbox\Parnasa\Web\drmeir\env\lib\site-packages\allauth\utils.py", line 153, in import_attribute
assert isinstance(path, str)
If I do not set the ACCOUNT_ADAPTER, everything works well including registration and authentication. I need to use custom account adapter to customize email verification.
Why am I getting the error and what should I do to fix it?
No need to import anything and no need for django.setup(). The configuration variable is a string!
ACCOUNT_ADAPTER = 'users.adapter.CustomAllauthAdapter'
I was working on the azure ad login for openEdx mobile app and as mentioned in the title, I got the NoneType response at token_exchange endpoint from azure ad.
Azure login have no problem authentication the user from the website login but login from the mobile got 'Service unavailable response' due to the following error log on the server.
I suspect the configuration issue but as far as I checked, i only need to set 'SOCIAL_AUTH_OAUTH_SECRETS' from lms.auth.json and 'THIRD_PARTY_AUTH_BACKENDS' and 'ENABLE_THIRD_PARTY_AUTH' from lms.env.json.
Please let me know if I miss something out. Thanks in advance
Apr 1 12:38:45 edxapp [service_variant=lms][django.request][env:sandbox] ERROR [edxapp 24509] [exception.py:135] - Internal Server Error: /oauth2/exchange_access_token/azuread-oauth2/
Traceback (most recent call last):
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
response = self._get_response(request)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 185, in inner
return func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/oauth_dispatch/views.py", line 57, in dispatch
return view(request, *args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/social_django/utils.py", line 49, in wrapper
return func(request, backend, *args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/auth_exchange/views.py", line 44, in dispatch
return super(AccessTokenExchangeBase, self).dispatch(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/views.py", line 489, in dispatch
response = self.handle_exception(exc)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/views.py", line 449, in handle_exception
self.raise_uncaught_exception(exc)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/rest_framework/views.py", line 486, in dispatch
response = handler(request, *args, **kwargs)
File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/auth_exchange/views.py", line 57, in post
if not form.is_valid():
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/forms/forms.py", line 183, in is_valid
return self.is_bound and not self.errors
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/forms/forms.py", line 175, in errors
self.full_clean()
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/forms/forms.py", line 385, in full_clean
self._clean_form()
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/provider/forms.py", line 63, in _clean_form
super(OAuthForm, self)._clean_form()
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/forms/forms.py", line 412, in _clean_form
cleaned_data = self.clean()
File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/auth_exchange/forms.py", line 95, in clean
user = backend.do_auth(access_token, allow_inactive_user=True)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/social_core/utils.py", line 252, in wrapper
return func(*args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/social_core/backends/oauth.py", line 410, in do_auth
data = self.user_data(access_token, *args, **kwargs)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/social_core/backends/azuread.py", line 80, in user_data
id_token = response.get('id_token')
AttributeError: 'NoneType' object has no attribute 'get'
I am using django-rest-auth registration api, I overridden that by using my own SERIALIZER and model. So I am getting error.
I have tried by setting active at the time user created. But that is not working.
Let me know how to resolve this type of problem.
[12/Jan/2019 17:24:06] "POST /rest-auth/registration/ HTTP/1.1" 400 68
Internal Server Error: /rest-auth/registration/
Traceback (most recent call last):
File "/Users/test/project/vblah/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Users/test/project/vblah/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/test/project/vblah/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/test/project/vblah/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/Users/test/project/vblah/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/Users/test/project/vblah/lib/python3.6/site-packages/django/utils/decorators.py", line 45, in _wrapper
return bound_method(*args, **kwargs)
File "/Users/test/project/vblah/lib/python3.6/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
return view(request, *args, **kwargs)
File "/Users/test/project/vblah/lib/python3.6/site-packages/rest_auth/registration/views.py", line 46, in dispatch
return super(RegisterView, self).dispatch(*args, **kwargs)
File "/Users/test/project/vblah/lib/python3.6/site-packages/rest_framework/views.py", line 495, in dispatch
response = self.handle_exception(exc)
File "/Users/test/project/vblah/lib/python3.6/site-packages/rest_framework/views.py", line 455, in handle_exception
self.raise_uncaught_exception(exc)
File "/Users/test/project/vblah/lib/python3.6/site-packages/rest_framework/views.py", line 492, in dispatch
response = handler(request, *args, **kwargs)
File "/Users/test/project/vblah/lib/python3.6/site-packages/rest_framework/generics.py", line 192, in post
return self.create(request, *args, **kwargs)
File "/Users/test/project/vblah/lib/python3.6/site-packages/rest_auth/registration/views.py", line 65, in create
user = self.perform_create(serializer)
File "/Users/test/project/vblah/lib/python3.6/site-packages/rest_auth/registration/views.py", line 81, in perform_create
None)
File "/Users/test/project/vblah/lib/python3.6/site-packages/allauth/account/utils.py", line 183, in complete_signup
signal_kwargs=signal_kwargs)
File "/Users/test/project/vblah/lib/python3.6/site-packages/allauth/account/utils.py", line 133, in perform_login
return adapter.respond_user_inactive(request, user)
File "/Users/test/project/vblah/lib/python3.6/site-packages/allauth/account/adapter.py", line 454, in respond_user_inactive
reverse('account_inactive'))
File "/Users/test/project/vblah/lib/python3.6/site-packages/django/urls/base.py", line 90, in reverse
return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "/Users/test/project/vblah/lib/python3.6/site-packages/django/urls/resolvers.py", line 622, in _reverse_with_prefix
raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'account_inactive' not found. 'account_inactive' is not a valid view function or pattern name.```
this exception happend because in your User model
is_active = False .
so set True and migrate
in models.py set is_active = True
and migrate the tables
I am using the HelloWorld example located at the ViewFlow cookbook.
The whole source code is same as the helloworld project with the only change being:
flows.py
check_approve = (
flow.If(lambda activation: activation.process.approved)
.Then(this.send)
.Else(this.start) # Edited (was this.end)
)
So basically I intend that if user keeps the Approved checkbox as un-selected and proceeds then it will push the task back to the start step.
I get this error when I run it:
NotImplementedError at /workflow/helloworld/helloworld/3/approve/11/
No exception message supplied
Internal Server Error: /workflow/helloworld/helloworld/3/approve/11/
Traceback (most recent call last):
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "/usr/lib/python3.6/contextlib.py", line 52, in inner
return func(*args, **kwds)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/decorators.py", line 213, in _wrapper
return view(request, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/flow/views/task.py", line 70, in dispatch
return super(BaseFlowMixin, self).dispatch(request, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/views/generic/edit.py", line 240, in post
return super(BaseUpdateView, self).post(request, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/django/views/generic/edit.py", line 183, in post
return self.form_valid(form)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/flow/views/task.py", line 86, in form_valid
self.activation_done(*args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/flow/views/task.py", line 78, in activation_done
self.activation.done()
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 44, in __call__
return self.descriptor(self.instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 112, in __call__
result = self.func(instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/activation.py", line 384, in done
self.activate_next()
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 44, in __call__
return self.descriptor(self.instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 112, in __call__
result = self.func(instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/activation.py", line 396, in activate_next
self.flow_task._next.activate(prev_activation=self, token=self.task.token)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/__init__.py", line 154, in activate
return self.activation_class.activate(self, prev_activation, token)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/activation.py", line 561, in activate
activation.perform()
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 44, in __call__
return self.descriptor(self.instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 112, in __call__
result = self.func(instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/activation.py", line 525, in perform
self.activate_next()
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 44, in __call__
return self.descriptor(self.instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/fsm.py", line 169, in __call__
result = self.func(instance, *args, **kwargs)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/nodes/ifgate.py", line 24, in activate_next
self.flow_task._on_false.activate(prev_activation=self, token=self.task.token)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/__init__.py", line 154, in activate
return self.activation_class.activate(self, prev_activation, token)
File "/home/admin-12/PycharmProjects/viewflow1/venv/lib/python3.6/site-packages/viewflow/activation.py", line 216, in activate
raise NotImplementedError
NotImplementedError
The problem seem to be that you try to jump to a flow.Start element in the else statement. Please try to jump to e.g. a flow.View element instead.