我正在使用flask + Angular + MongoDb应用程序。我正在使用状态提供程序。状态从应用程序加载完美。但是当我刷新页面时,它正在抛出404错误。Python烧瓶角度应用程序状态不刷新
- App.py:(烧瓶)
application = Flask(__name__) @application.route('/') def showMachineList(): print ("Inside the show machine list function") return application.make_response(open('templates/index.html').read())
- App.js(角)
- 国家
angular.module('testapp', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.router', 'ui.bootstrap','ngMaterial','ngCookies' ]) .config(function($urlRouterProvider, $locationProvider,$interpolateProvider) { $urlRouterProvider.otherwise('/'); //$interpolateProvider.startSymbol('//').endSymbol('//'); $locationProvider.html5Mode(true).hashPrefix('!'); });
angular.module('testapp') .config(function ($stateProvider) { console.log("inside create outage request") $stateProvider .state('cor', { url: '/cor', template: '<cor></cor>' //templateUrl: '/static/client/app/acn/acn.html' }); });
我已经加入index.html中的<base href="/">
为好。 当我刷新页面"http://localhost:5000/cor"
其投掷404. 你能让我知道我失踪了吗?
但我已经定义了状态,我认为它也应该从Angular状态加载。 –
您的HTML模板中可能有一个错误。 –