【发布时间】:2017-03-24 02:48:02
【问题描述】:
在我的代码中
File Structure:
App-
|--- static
| |--- css
| |--- js
| |--- app.js
|
|--- templates
| | --- header.html
| | --- template.html
| | --- footer.html
| | --- index.html
|--- startup.py
启动.py: 这是告诉龙卷风在哪里找到文件的设置
settings = dict (
template_path = os.path.join(os.path.dirname(__file__), "templates"),
static_path = os.path.join(os.path.dirname(__file__), "static"),
debug = True
)
app.js: 这是使用ui-router配置路由的角度js
var app = angular.module('app', [
'ui.router'
]);
app.config(['$urlRouterProvider', '$stateProvider',
function($urlRouterProvider, $stateProvide) {
$urlRouterProvider.otherwise('/');
$stateProvide
.state('template', {
url:'/',
templateUrl: 'template.html',
controller: 'myController'
})
}])
索引.html: 这是模板文件
<!DOCTYPE html>
<html>
<head >
<title>
</title>
<script type="text/javascript" src=" {{ static_url('lib/js/angular.js') }}"></script>
<script type="text/javascript" src=" {{ static_url('lib/js/angular-ui-router.js') }}"></script>
<script type="text/javascript" src=" {{ static_url('lib/js/jquery-3.2.0.js') }}"></script>
<script type="text/javascript" src=" {{ static_url('lib/js/bootstrap.js') }}"></script>
<script type="text/javascript" src=" {{ static_url('js/app.js') }}"></script>
<link rel="stylesheet" type="text/css" href="{{ static_url('lib/css/bootstrap.css') }}">
<link rel="stylesheet" type="text/css" href="{{ static_url('css/app.css') }}">
</head>
<body ng-app='app'>
<header ng-include src="'header.html'"></header>
<div ui-view>
</div>
<footer ng-include src="'footer.html'"></footer>
</body>
现在我的问题是: 找不到我在 index.html 中使用 ng-include 的 header.html 和 footer.html。在 app.js 中,templateUrl: 'template.html';也没有找到。当我不使用龙卷风作为服务器时,它是有效的。但是在龙卷风服务器中,它不再起作用了。请帮我。谢谢
【问题讨论】:
标签: python html angularjs tornado