diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index 19723bb6bb..3d94e9c545 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -1,8 +1,19 @@ from django.conf.urls import url, include from django.contrib import admin +from rest_framework import status +from rest_framework.response import Response +from rest_framework.decorators import api_view + admin.site.site_header = "InvenTree Admin" +@api_view() +def Inventree404(self): + """ Supplied URL is invalid + """ + content = {'detail': 'Malformed API URL'} + return Response(content, status=status.HTTP_404_NOT_FOUND) + urlpatterns = [ url(r'^stock/', include('stock.urls')), url(r'^part/', include('part.urls')), @@ -10,5 +21,8 @@ urlpatterns = [ url(r'^track/', include('track.urls')), url(r'^project/', include('project.urls')), url(r'^admin/', admin.site.urls), - url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')) + url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')), + + # Any other URL + url(r'', Inventree404) ]