File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import asyncio
2-
31from tornado import gen
4- from tornado .web import RequestHandler , Application , StaticFileHandler , url
2+ from tornado .web import Application , RequestHandler , StaticFileHandler
53from tornado .platform .asyncio import AsyncIOMainLoop
64
75from jinja2 import Environment , PackageLoader
@@ -25,8 +23,13 @@ def get_application():
2523class TestHandler (RequestHandler ):
2624 @gen .coroutine
2725 def get (self ):
28- template = wi .env .get_template ('layout.html' )
29- self .write (template .render ())
26+ template = wi .env .get_template ('basic.html' )
27+ args = {
28+ 'main_title' : 'CloudBot' ,
29+ 'heading' : 'Placeholder Page' ,
30+ 'text' : 'Lorem ipsum!'
31+ }
32+ self .write (template .render (** args ))
3033
3134
3235class WebInterface ():
Original file line number Diff line number Diff line change 1+ {% extends "layout.html" %}
2+ {% block title %}{{ heading }} - {{ super() }}{% endblock %}
3+ {% block content %}
4+ < div class ="placeholder ">
5+ < h1 > {{ heading }}</ h1 >
6+ < p class ="lead "> {{ text }}</ p >
7+ </ div >
8+ {% endblock %}
Original file line number Diff line number Diff line change 11<!DOCTYPE html>
22< html lang ="en ">
33< head >
4+ {% block head %}
45 < meta charset ="utf-8 ">
56 < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
67 < meta name ="viewport " content ="width=device-width, initial-scale=1 ">
910 < meta name ="author " content ="">
1011 < link rel ="icon " href ="../../favicon.ico ">
1112
12- < title > Starter Template for Bootstrap </ title >
13+ < title > {% block title %}{{ main_title }}{% endblock %} </ title >
1314
1415 <!-- Bootstrap core CSS -->
1516 < link href ="./s/css/bootstrap.min.css " rel ="stylesheet ">
2021 <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
2122 <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
2223 <![endif]-->
24+ {% endblock %}
2325</ head >
2426
2527< body >
3436 < span class ="icon-bar "> </ span >
3537 < span class ="icon-bar "> </ span >
3638 </ button >
37- < a class ="navbar-brand " href ="# "> Project name </ a >
39+ < a class ="navbar-brand " href ="# "> {{ main_title }} </ a >
3840 </ div >
3941 < div id ="navbar " class ="collapse navbar-collapse ">
4042 < ul class ="nav navbar-nav ">
4850</ nav >
4951
5052< div class ="container ">
51-
52- < div class ="placeholder ">
53- < h1 > Placeholder Text</ h1 >
54-
55- < p class ="lead "> Use this document as a way to quickly start any new project.< br > All you get is this text and a
56- mostly barebones HTML document.</ p >
57- </ div >
58-
53+ {% block content %}{% endblock %}
5954</ div >
6055<!-- /.container -->
6156
You can’t perform that action at this time.
0 commit comments