使用AngularJs和Django Python路由重定向错误

时间:2016-03-31 06:19:09

标签: angularjs django python-3.x django-rest-framework

这是早些时候工作,直到几个小时前,它停止工作。我在我导入的所有JS文件中获得了HTTP / 1.1 304 0。 我有一个" base.html"包括 {%load staticfiles%}

<!DOCTYPE html>
<html ng-app="medicrib">
    <head>
        <title>Medical Crib | Home Page</title>
        <!--Import Google Icon Font-->
        <link href="http://fonts.googleapis.com/icon?family=Material+Icons"
            rel="stylesheet">
        <meta charset="utf-8">
        <!--Let browser know website is optimized for mobile-->
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />

        <meta name="description" content="">
        <!--Import materialize.css-->
        <link rel="stylesheet" type="text/css" href="{% static 'css/materialize/css/materialize.css' %}" media="screen,projection" />


    </head>
    <body>
        {% include 'navbar.html' %}
            {% block content %}



            <div class="container-fluid">
                <div class="row">
                    <div class="col-xs-12 ng-view"></div>
                </div>
            </div>




        {% endblock content %}


<script src="https://code.jquery.com/jquery-2.2.2.min.js"   
    integrity="sha256-36cp2Co+/62rEAAYHLmRCPIych47CvdM+uTBJwSzWjI="crossorigin="anonymous">
</script>
<script type="text/javascript" src="{% static 'css/materialize/js/materialize.min.js' %}">
</script>
<script type="text/javascript" src="{% static 'js/main.js' %}"></script>
<script type="text/javascript" src="{% static 'js/underscore/underscore.js' %}"></script>
<!-- <script type="text/javascript" src="{% static 'js/angular/angular.js' %}"></script> -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.3/angular.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.3/angular-route.min.js"></script>
<!--<script type="text/javascript" src="{% static 'js/angular/angular-route.js' %}"></script> -->
<script type="text/javascript" src="{% static 'js/angular/angular-cookies.js' %}"></script>
<script type="text/javascript" src="{% static 'js/ngDialog/js/ngDialog.js' %}"></script>
<script type="text/javascript" src="{% static 'js/snackbarjs/dist/snackbar.min.js' %}">
</script>
<script type="text/javascript" src="{% static 'js/medicrib.js' %}"></script>

<script type="text/javascript" src="{% static 'js/medicrib.config.js' %}"></script>
<script type="text/javascript" src="{% static 'js/medicrib.routes.js' %}"></script>
<script type="text/javascript" 
    src="{% static 'js/authentication/authentication.module.js' %}"></script>
<script type="text/javascript" 
    src="{% static 'js/layout/layout.module.js' %}"></script>   
<script type="text/javascript" 
    src="{% static 'js/authentication/services/authentication.service.js' %}"></script>
<script type="text/javascript" 
    src="{% static 'js/authentication/controllers/register.controller.js' %}"></script>
<script type="text/javascript" 
    src="{% static 'js/authentication/controllers/login.controller.js' %}"></script>
<script type="text/javascript" 
    src="{% static 'js/layout/controllers/navbar.controller.js' %}"></script>





    </body>
</html>

和路线文件

(function () {
    'use strict';


    angular
        .module('medicrib.routes')
        .config(config);


    config.$inject = ['$routeProvider'];

  //var medicrib = angular.module('medicrib', ['ngRoute']);

    /**
    * @name config
    * @desc Define valid application routes
    */  

    function config($routeProvider) {
        $routeProvider.when('/register', {
            controller: 'RegisterController',
            controllerAs: 'vm',
            templateUrl: '/templates/authentication/register.html'
        }).when('/login', {
        controller: 'LoginController',
        controllerAs: 'vm',
        templateUrl: '/templates/authentication/login.html'
      }).otherwise('/');

    }
})(); 

我无法访问我的login.html和register.html页面,请提供帮助。

{% extends "base.html" %}

{% block content %}


 <div class="row">
    <form class="col s12" ng-submit="vm.login()">
      <div class="alert alert-danger" ng-show="error" ng-bind="error"> </div>
      <h2>Login</h2>


      <div class="row form-group">
        <div class="input-field col s12">
          <input id="login_email" type="email" class="form-control validate" 
          ng-model="vm.email" />
          <label for="login_email">Email</label>
        </div>
      </div>

      <div class="row form-group">
        <div class="input-field col s12">
          <input id="login_password" type="password" class="form-control validate" 
              ng-model="vm.password" >
          <label for="login_password">Password</label>
        </div>
      </div>

       <div class="form-group">
          <button type="submit" class="btn btn-primary">Login</button>
        </div>
    </form>
  </div>

  {% endblock %}

0 个答案:

没有答案