5๐
I simply achieved this by extending the router registries.
root urls.py
from ad.urls import router as ad_router
main_router = routers.DefaultRouter()
main_router.registry.extend(ad_router.registry)
ad.urls.py
from .api.urls import router as api_router
router = routers.DefaultRouter()
router.registry.extend(api_router.registry)
ad.api.urls.py
router = routers.DefaultRouter()
router.register(r'ad', AdViewSet)
๐คrob.t.ux
2๐
In your main urls.py
you would do something like this.
(This is for Django 1.8)
urlpatterns += patterns('',
url(r'^api/', include(patterns('',
url(r'^foo_app/', include('foo_app.urls')),
url(r'^bar_app/', include('bar_app.urls')),
url(r'^test_app/', include('test_app.urls')),
))))
this allows you to access all your endpoints this way
localhost:8000/api/foo_app/<foo_app_endpoint>
localhost:8000/api/bar_app/<bar_app_endpoint>
localhost:8000/api/bar_app/<test_app_endpoint>
๐คAngela
- [Django]-Allowing both email and username login in Django project
- [Django]-Crispy Forms Initial data
- [Django]-South data migration from parent class to subclass clobbers parent data
- [Django]-How to properly show image stored from a remote file server to a django HTML template?
- [Django]-Django loaddata settings error
Source:stackexchange.com