In my AngularJS app i've made a simple URL configuration by Angular-UI-router:
config(function($stateProvider, $urlRouterProvider, $locationProvider){
$urlRouterProvider.otherwise("/");
$stateProvider
.state({
name: 'land',
url: "/",
templateUrl: "main_ang.html",
controller: 'showSomethingCtrl'
})
.state({
name: 'tournaments',
url: "tournaments/",
templateUrl: 'tournaments_list_ang.html',
controller: 'showTournamentsCtrl'
});
$locationProvider.html5Mode(true);
})
First this app was Django based, but right now i want it to be rewritten in terms of Django Rest Framework and AngularJS, that is why i commented out '/tournaments/' URL from Django's urls.py:
urlpatterns = patterns('',
url(r'^$', "chess_tournaments.views.Main", name='main'),
# url(r'^tournaments/$', 'chess_tournaments.views.TournamentsView', name='tournaments'),
# url(r'^tournament/(?P<tournament_id>\d+)/$', 'chess_tournaments.views.TournamentDetailView',
# name='tournament_detail'),
url(r'^tournament_new/$', 'chess_tournaments.views.TournamentDetailView', name='tournament_new'),...
Everything goes well when i navigate to 127.0.0.8000 first and then click proper link with ui-sref="tournaments". But navigating to 127.0.0.8000/tournaments leads to "Page not found (404)" error. I guess i should serve angular's app first to client's browser, but what is the right way to do that?