我正在尝试自学Python。我在controller.py文件中有以下代码:
$def with (page)
$var css: static/css/bootstrap.css
$var js1: static/js/jquery-3.1.0.min.js static/js/bootstrap.js static/js/material.min.js static/js/ripple.min.js static/js/scripty.js
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CodeWizard</title>
$if self.css:
$for style in self.css.split():
<link rel="stylesheet" href="$style" />
</head>
<body>
<div id="app">
<div class="navbar navbar-info navbar-fixed-top">
<div class="navbar-header">
<a class="navbar-brand">CodeWizard</a>
</div>
<ul class="nav navbar-nav">
<li>
<a class="waves-effect" href="/">Home Feed<div class="ripple-container"></div></a>
</li>
<li>
<a href="/discover">Discover<div class="ripple-container"></div></a>
</li>
<li>
<a href="/profile">Profile<div class="ripple-container"></div></a>
</li>
<li>
<a href="/settings">Settings<div class="ripple-container"></div></a>
</li>
</ul>
<div class="pull-right">
<a href="/register" class="btn btn-raised btn-default waves-effect">Register</a>
</div>
</div>
<br /><br />
$:page
</div>
$if self.js1:
$for script in self.js1.split():
<script src="$script"></script>
</body>
</html>
这是我的MainLayout.html中的代码:
AggregationBuilder aggregation =
AggregationBuilders
.dateRange("agg")
.field("date_created")
.format("MM")
.addRange(11, 12) // from 11 to 12 (excluded)
SearchRequest searchRequest = new SearchRequest("index_name");
searchRequest.types(Long.toString(1234));
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder
.query(QueryBuilders.matchAllQuery())
.aggregation(aggregation);
SearchResponse searchResponse = this.client.search(searchRequest);
我有2个额外的文件(home.html和register.html),我有可用的bootstrap(尽管这与我的问题无关)。
当我启动应用程序并打开浏览器并输入localhost:8080作为URL时,MainLayout.html被加载到浏览器中(我期望)但是register.html的内容被加载到$:page和I中不知道为什么。
当我从网址中删除第二个条目并从controller.py中删除regnsterclick类时,将加载MainLayout.html页面,似乎没有任何内容加载到$:page。
为什么要提交register.html的内容?非常感谢任何帮助。
感谢。