I have created a projects which has two apps in it, app1, app2 both having,
router = routers.DefaultRouter()
in its url.py, both of them as a standalone app ie if other app router is commented, will show correct default root API of all links. But when launching both of them, I am having an issue of apps2 api links coming in app1, by overwriting similar links of app1 which is similar in terms of serilizer, viewset and model name
This is my projects urls.py file
from django.urls import path, include
urlpatterns = [
path('app1/', include('app1.urls'),name='oc_url'),
path('app2/', include('app2.urls'),name='pc_url'),
]
App1 urls.py is
from app1.views import ActiveUsersViewSet,ProjectsViewSet,TestsExecutedViewSet,TestRunsViewSet,DefectsViewSet,FeaturesViewSet
router = routers.DefaultRouter()
router.register(r'activeusers', ActiveUsersViewSet)
router.register(r'projects', ProjectsViewSet)
router.register(r'testsexecuted', TestsExecutedViewSet)
router.register(r'testruns', TestRunsViewSet)
router.register(r'defects', DefectsViewSet)
router.register(r'features', FeaturesViewSet)
App2 urls.py
from app2.views import ActiveUsersViewSet,ProjectsViewSet,SessionsHistoryViewSet
router = routers.DefaultRouter()
router.register(r'activeusers', ActiveUsersViewSet)
router.register(r'projects', ProjectsViewSet)
router.register(r'sessionshistory', SessionsHistoryViewSet)
The issue is coming with api which is related to models which has same name in both apps. Is it because I have same models with same name in both apps? Any suggestions to fix this?