Documentation have a lot of missing information
EasyNetDev opened this issue · 5 comments
Hi,
Each time I'm trying to follow OpenWISP Radius configuration I notice that is outdated.
For example:
- Is not mention that you need to install the python-dateutil.
$ pip3 install python-dateutil
- mysqlclient module for MariaDB/MySQL is not mentioned that you need to install
$ pip3 install mysqlclient
- Social media login is complettly broken. From the first time I tried to install OpenWISP Radius I faced this issue.
The configuration from documents ends with this when I'm trying to run it
django.contrib.admin.sites.NotRegistered: The model SocialApp is not registered
I couldn't find any solution to this issue, just to remove the Social Media configuration.
-
Point 3 is leading to issues when I'm trying to delete stuff in OpenWISP Radius, similar to bug #267.
-
The part with ./manage.py collectstatic is not mantioned anyway. Also there is no info how to install correctly the OpenWISP Radius templates. After long searches on internet I found this command, but the template is still Djingo one.
-
Starting with Djingo 4.x there is necessary to install and set django-cors-headers, otherwise all POST are rejected:
$ python -m pip install django-cors-headers
CSRF_TRUSTED_ORIGINS = [
'http://localhost:8000',
'https://YOUR_HOST.DOM',
]
CORS_ALLOWED_ORIGINS = [
'http://localhost:8000',
'https://YOUR_HOST.DOM',
]
CORS_ORIGIN_WHITELIST = [
'http://localhost:8000',
'https://YOUR_HOST.DOM',
]
CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
There is a better documentation somewhere else where I can use to install correclty this software?
I'm using a virtual enviroment for my setup, using like this:
# python3 -m pip install --user virtualenv
# su openwisp
$ cd /opt/
$ python3 -m venv openWISP
$ source openWISP/bin/activate
$ which python
/opt/openWISP/bin/python
$ pip install -U pip setuptools wheel
$ pip install openwisp-radius
Thanks for bringing this up @EasyNetDev, let's see:
- Is not mention that you need to install the python-dateutil.
$ pip3 install python-dateutil
I am not aware that this is required, it could be and we could add it to the
dependencies to be installed automatically when openwisp-radius is installed,
however:
there is no unit test currently failing because this package is missing.
So my question is, what steps are needed to replicate this problem?
- mysqlclient module for MariaDB/MySQL is not mentioned that you need to install
$ pip3 install mysqlclient
We could add this info to https://openwisp-radius.readthedocs.io/en/stable/developer/setup.html
and have a section for MySQL and one for PostgreSQL.
- Social media login is completly broken. From the first time I tried to install OpenWISP Radius I faced this issue.
The configuration from documents ends with this when I'm trying to run itdjango.contrib.admin.sites.NotRegistered: The model SocialApp is not registered
I couldn't find any solution to this issue, just to remove the Social Media configuration.
To say something is completely broken is not helpful.
This feature is deployed successfully in several installations.
Please list the steps you are making to encounter this issue so we can
look into it.
- Point 3 is leading to issues when I'm trying to delete stuff in OpenWISP Radius, similar to bug [bug] Site deletion results in an error #267.
- The part with ./manage.py collectstatic is not mantioned anyway. Also there is no info how to install correctly the OpenWISP Radius templates. After long searches on internet I found this command, but the template is still Djingo one.
It's a standard deployment procedure with Django which we do not need to repeat in our docs,
also because we do not have a section dedicated to production deployments,
we simply recommend to use ansible openwisp2 (see https://openwisp-radius.readthedocs.io/en/stable/developer/setup.html#deploy-it-in-production).
- Starting with Djingo 4.x there is necessary to install and set django-cors-headers, otherwise all POST are rejected:
It's not a matter of Django 4, if you have a webpage which is not hosted on
the same domain and needs to use the OpenWISP RADIUS API, you will need to enable CORS.
We could add this info in the setup page too, to clarify.
There is a better documentation somewhere else where I can use to install correclty this software? I'm using a virtual enviroment for my setup, using like this:
This is the docs we have, let's improve it.
The ansible openwisp2 role is recommended for prod deployments:
https://github.com/openwisp/ansible-openwisp2#enabling-the-radius-module
The development version supports CORS too:
openwisp/ansible-openwisp2#380 .
Hi @nemesisdesign ,
Thanks for your info. That's good. I will try to fork the sources and add this info in the documentation.
After fighting with my previous databases, seems that even I'm trying to migrate the old DB to a correct one to have table 'openwispRadius.allauth_socialapp_sites' in my DB, I wasn't able to fix it in anyway I tried.
After I deleted the whole database and I did:
$ ./manage.py migrate
I manage to fix my issue for bug #267 . I have no clue why this happen, but I was strugguling with this issue for few months.
Now I will start a fresh instalation for this OpenWISP Radius.
I will do another installation in a few days to have an exact output errors for the dependencies I faced in my instalation.
Also I'm using the devel version right now.
But now I'm facing another error when I'm trying to add an Owner to the Organization:
Environment:
Request Method: POST
Request URL: http://MYHOST.COM/vpngui/admin/openwisp_users/organization/7b51c6f6-9cb8-4d9c-9db2-c8121770b0b8/change/
Django Version: 4.1
Python Version: 3.9.2
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'openwisp_utils.admin_theme',
'rest_framework.authtoken',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'django.contrib.admin',
'rest_framework',
'django_filters',
'dj_rest_auth',
'dj_rest_auth.registration',
'openwisp_radius',
'openwisp_users',
'private_storage',
'drf_yasg',
'corsheaders']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'social_django.middleware.SocialAuthExceptionMiddleware']
Traceback (most recent call last):
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/contrib/admin/options.py", line 686, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/views/decorators/cache.py", line 62, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/contrib/admin/sites.py", line 242, in inner
return view(request, *args, **kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1893, in change_view
return self.changeform_view(request, object_id, form_url, extra_context)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/utils/decorators.py", line 46, in _wrapper
return bound_method(*args, **kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1750, in changeform_view
return self._changeform_view(request, object_id, form_url, extra_context)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1801, in _changeform_view
if all_valid(formsets) and form_validated:
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/forms/formsets.py", line 576, in all_valid
return all([formset.is_valid() for formset in formsets])
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/forms/formsets.py", line 576, in <listcomp>
return all([formset.is_valid() for formset in formsets])
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/forms/formsets.py", line 383, in is_valid
self.errors
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/forms/formsets.py", line 365, in errors
self.full_clean()
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/forms/formsets.py", line 428, in full_clean
form_errors = form.errors
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/forms/forms.py", line 200, in errors
self.full_clean()
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/forms/forms.py", line 439, in full_clean
self._post_clean()
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/forms/models.py", line 492, in _post_clean
self.instance.full_clean(exclude=exclude, validate_unique=False)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/db/models/base.py", line 1471, in full_clean
self.clean()
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/openwisp_users/base/models.py", line 233, in clean
if self.organization_user.organization.pk != self.organization.pk:
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/db/models/fields/related_descriptors.py", line 215, in __get__
raise self.RelatedObjectDoesNotExist(
Exception Type: RelatedObjectDoesNotExist at /vpngui/admin/openwisp_users/organization/7b51c6f6-9cb8-4d9c-9db2-c8121770b0b8/change/
Exception Value: OrganizationOwner has no organization_user.
I don't know if is a bug or I still have something missing.
And if I want to add a new Organization owner I'm getting again an error:
Environment:
Request Method: POST
Request URL: http://MYHOST.COM/vpngui/admin/openwisp_users/organizationowner/add/
Django Version: 4.1
Python Version: 3.9.2
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'openwisp_utils.admin_theme',
'rest_framework.authtoken',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'django.contrib.admin',
'rest_framework',
'django_filters',
'dj_rest_auth',
'dj_rest_auth.registration',
'openwisp_radius',
'openwisp_users',
'private_storage',
'drf_yasg',
'corsheaders']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'social_django.middleware.SocialAuthExceptionMiddleware']
Traceback (most recent call last):
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/contrib/admin/options.py", line 686, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/views/decorators/cache.py", line 62, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/contrib/admin/sites.py", line 242, in inner
return view(request, *args, **kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1890, in add_view
return self.changeform_view(request, None, form_url, extra_context)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/utils/decorators.py", line 46, in _wrapper
return bound_method(*args, **kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1750, in changeform_view
return self._changeform_view(request, object_id, form_url, extra_context)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1796, in _changeform_view
form_validated = form.is_valid()
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/forms/forms.py", line 205, in is_valid
return self.is_bound and not self.errors
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/forms/forms.py", line 200, in errors
self.full_clean()
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/forms/forms.py", line 439, in full_clean
self._post_clean()
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/forms/models.py", line 492, in _post_clean
self.instance.full_clean(exclude=exclude, validate_unique=False)
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/db/models/base.py", line 1471, in full_clean
self.clean()
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/openwisp_users/base/models.py", line 233, in clean
if self.organization_user.organization.pk != self.organization.pk:
File "/opt/openwisp-radius/openWISP/lib/python3.9/site-packages/django/db/models/fields/related_descriptors.py", line 215, in __get__
raise self.RelatedObjectDoesNotExist(
Exception Type: RelatedObjectDoesNotExist at /vpngui/admin/openwisp_users/organizationowner/add/
Exception Value: OrganizationOwner has no organization_user.
The OrganizationOwner
issue must be related to openwisp-users, how are you replicating that one?
You can work around it by simply assigning a user as a member of the organization from the user management page, that user will automatically become owner of the organization.
Hi,
Ok. If I'm adding the user under organization, is working. But if I'm going to Home -> Users and Organizations -> Organization owners
and I'm trying to add here:
And after field are looking like:
then I'm getting the error:
Same issue if I'm going to: Home › Users and Organizations › Organizations › My Organization
and I'm adding the user and try to save it, I'm getting again a similar error:
Then the error:
Complaining error is a lillte bit confusing: indeed there is no owner, but that's the idea to add an owner.