From c762a86f2f7c772749f2dfab4f41ce667614b377 Mon Sep 17 00:00:00 2001 From: asgharsir Date: Mon, 19 Jul 2021 11:27:38 +0100 Subject: [PATCH 1/3] [FIXES #344] Real Cause of 'rest_framework namespace is not Unique' is not fixed --- geonode_mapstore_client/apps.py | 4 +++- mapstore2_adapter/api/urls.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/geonode_mapstore_client/apps.py b/geonode_mapstore_client/apps.py index 5115312928..838705223f 100644 --- a/geonode_mapstore_client/apps.py +++ b/geonode_mapstore_client/apps.py @@ -10,6 +10,7 @@ ######################################################################### from django.apps import AppConfig as BaseAppConfig from django.utils.translation import ugettext_lazy as _ +from django.apps import apps def run_setup_hooks(*args, **kwargs): @@ -28,5 +29,6 @@ class AppConfig(BaseAppConfig): label = "geonode_mapstore_client" def ready(self): - run_setup_hooks() + if not apps.ready: + run_setup_hooks() super(AppConfig, self).ready() diff --git a/mapstore2_adapter/api/urls.py b/mapstore2_adapter/api/urls.py index ae51a72305..24b2947f51 100644 --- a/mapstore2_adapter/api/urls.py +++ b/mapstore2_adapter/api/urls.py @@ -19,5 +19,5 @@ urlpatterns = [ url(r'^rest/', include(router.urls)), - url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')) + url(r'^api-auth/', include('rest_framework.urls', namespace='mapstore2_adapter_apis')) ] From 4688bc70f5f7fc670270b522b0e59f18fee06d6f Mon Sep 17 00:00:00 2001 From: asgharsir Date: Tue, 20 Jul 2021 09:49:23 +0100 Subject: [PATCH 2/3] added a comment --- mapstore2_adapter/api/urls.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mapstore2_adapter/api/urls.py b/mapstore2_adapter/api/urls.py index 24b2947f51..e7088416d3 100644 --- a/mapstore2_adapter/api/urls.py +++ b/mapstore2_adapter/api/urls.py @@ -19,5 +19,6 @@ urlpatterns = [ url(r'^rest/', include(router.urls)), + # rest_framework.urls may be skipped, if it is supposed to be always inside geonode url(r'^api-auth/', include('rest_framework.urls', namespace='mapstore2_adapter_apis')) ] From 81ca389fe1ea64b0689850475572bdfb819e44d1 Mon Sep 17 00:00:00 2001 From: asgharsir Date: Tue, 20 Jul 2021 17:35:29 +0100 Subject: [PATCH 3/3] removed rest_framework.urls --- mapstore2_adapter/api/urls.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mapstore2_adapter/api/urls.py b/mapstore2_adapter/api/urls.py index e7088416d3..b97c73ab63 100644 --- a/mapstore2_adapter/api/urls.py +++ b/mapstore2_adapter/api/urls.py @@ -18,7 +18,5 @@ router.register(r'resources', views.MapStoreResourceViewSet, basename="resources") urlpatterns = [ - url(r'^rest/', include(router.urls)), - # rest_framework.urls may be skipped, if it is supposed to be always inside geonode - url(r'^api-auth/', include('rest_framework.urls', namespace='mapstore2_adapter_apis')) + url(r'^rest/', include(router.urls)) ]