python网页模板_python-找不到HTML模板

在尝试使用AngularJS进行路由配置并从Flask后端加载模板时遇到问题,页面无法找到。作者提到默认启动的index.html包含ng-view,用于注入配置的页面。项目结构和角度路由配置被详细说明,但即使为templateUrl添加了'/‘前缀,问题仍未解决。
摘要由CSDN通过智能技术生成

这个问题已经在这里有了答案:????????????>????????????angularjs unable to find templates directory, flask as backend????????????????????????????????????1个

当我尝试从模板文件夹加载注入的页面时,出现页面未找到错误. index.html页面是我启动服务器时默认启动的页面,它还包含ng-view,因此我可以注入angular配置中指定的页面.

这是我的项目结构:

angular_routing/

flask_service.py

static/

script.js

templates/

index.html

home.html

....

这是我的角度路由:

// configure our routes

scotchApp.config(function($routeProvider) {

$routeProvider

// route for the home page

.when('/', {

templateUrl : 'templates/home.html',

controller : 'mainController'

})

// route for the about page

.when('/about', {

templateUrl : 'templates/about.html',

controller : 'aboutController'

})

// route for the contact page

.when('/contact', {

templateUrl : 'templates/contact.html',

controller : 'contactController'

})

.otherwise({

templateUrl: '/',

controller: 'mainController'

});

// $locationProvider.html5Mode(true);

});

顺便说一句,我尝试给templateUrl加上’/’前缀,但是它也不起作用.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值