I'm using an AngularJS app with Django Rest Framework. However, I've setup my project such that the Angular page is served from within the templates folder of my setup such that
url(r'^$', index)
def index(request):
return render(request, 'index.html', {})
I'm running the angular app on / url of Django and have setup my ngRoutes as follows:
var sgApp = angular.module('sgApp', [
'ngRoute',
]);
sgApp.config(['$routeProvider','$locationProvider',
function($routeProvider, $locationProvider){
$routeProvider.when('/',{
templateUrl: '/static/partials/index.html'
});
$locationProvider.html5Mode(true);
}
]);
However, when I try to access an invalid url such as localhost:8000/some-random-url, it'll redirect to Django's inbuilt 404 page. Is there a way for me to fix this? Or do I have to completely abstract the angular app from the rest framework?