From b0ce4a11673b50018ca64e12741cad5df6aeb90e Mon Sep 17 00:00:00 2001 From: Adrian Turjak Date: Fri, 15 Sep 2017 12:02:57 +1200 Subject: [PATCH] be able to disable a given API version Change-Id: I1827e853b34c05ff3753636a6c4968d86c3f565f --- adjutant/api/urls.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/adjutant/api/urls.py b/adjutant/api/urls.py index d1667b3..b873bd9 100644 --- a/adjutant/api/urls.py +++ b/adjutant/api/urls.py @@ -12,14 +12,19 @@ # License for the specific language governing permissions and limitations # under the License. +from django.apps import apps from django.conf.urls import url, include from django.conf import settings from rest_framework_swagger.views import get_swagger_view -urlpatterns = [ - url(r'^v1/', include('adjutant.api.v1.urls')), -] +urlpatterns = [] + +# NOTE(adriant): This may not be the best approach, but it does work. Will +# gladly accept a cleaner alternative if it presents itself. +if apps.is_installed('adjutant.api.v1'): + urlpatterns.append(url(r'^v1/', include('adjutant.api.v1.urls'))) + if settings.DEBUG: schema_view = get_swagger_view(title='Adjutant API')