I am following https://pypi.org/project/djangorestframework-sso/ tutorial for sso authentication in django, In first step they added 'rest_framework_sso' in INSTALLED_APPSin settings.py without installing any such library. When I tried to do the same I got:
ModuleNotFoundError: No module named 'rest_framework_sso'
Then I tried pip/pip3 install 'rest_framework_sso' but I got:
ERROR: Could not find a version that satisfies the requirement rest_framework_sso (from versions: none)
ERROR: No matching distribution found for rest_framework_sso
Then I installed django rest framework but it still is not working.
I want to know why is it not working and how can I solve this, I didn't find anything that can help me related to this.
(For the wiki-aspect, I'll write down a proper answer in case someone comes by the question later)
We have to differentiate between two things here: The name of the package on Pypi, which is what you have to use with pip
, and the name of the python module that is provided in that package.
For the django rest framework SSO package, the Pypi package name currently is djangorestframework-sso
, so that has to be used with pip
pip install djangorestframework-sso
However, the python module that this allows you to use is named rest_framework_sso
, so when adding this to the INSTALLED_APPS
or using it in any other way in python, you need to use this name, as demonstrated in the documentation:
from rest_framework_sso.views import obtain_session_token
# go on to use obtain_session_token
If you wonder, there is a questions about why this is the case