forked from liukai234/python_course_record
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
liukai234
committed
May 31, 2020
1 parent
cb7b720
commit 8f280a0
Showing
4 changed files
with
96 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,51 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
{% block head %} | ||
<!-- Required meta tags --> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
|
||
<head> | ||
{% block styles %} | ||
<!-- Bootstrap CSS --> | ||
{{ bootstrap.load_css() }} | ||
{% endblock %} | ||
|
||
</head> | ||
|
||
<body> | ||
<h1>Hello World!</h1> | ||
<!--标记路由--> | ||
<a href="{{ url_for('r404') }}">404</a> | ||
<!--img css js的静态文件使用的路由--> | ||
<img src="{{ url_for('static', filename='img/main.jpg') }}" | ||
</body> | ||
<title>Your page title</title> | ||
{% endblock %} | ||
</head> | ||
<body> | ||
<!-- Your page content --> | ||
{% block content %} | ||
<div class="alert alert-primary" role="alert"> | ||
A simple primary alert—check it out! | ||
</div> | ||
<div class="alert alert-secondary" role="alert"> | ||
A simple secondary alert—check it out! | ||
</div> | ||
<div class="alert alert-success" role="alert"> | ||
A simple success alert—check it out! | ||
</div> | ||
<div class="alert alert-danger" role="alert"> | ||
A simple danger alert—check it out! | ||
</div> | ||
<div class="alert alert-warning" role="alert"> | ||
A simple warning alert—check it out! | ||
</div> | ||
<div class="alert alert-info" role="alert"> | ||
A simple info alert—check it out! | ||
</div> | ||
<div class="alert alert-light" role="alert"> | ||
A simple light alert—check it out! | ||
</div> | ||
<div class="alert alert-dark" role="alert"> | ||
A simple dark alert—check it out! | ||
</div> | ||
{% endblock %} | ||
|
||
{% block scripts %} | ||
<!-- Optional JavaScript --> | ||
{{ bootstrap.load_js() }} | ||
{% endblock %} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,47 @@ | ||
<h1>Hello {{ name }}!</h1> | ||
<!-- <h1>Hello {\{ name }\}!</h1> --> | ||
|
||
<!--Jinja2能识别所有类型的变量,甚至是一些复杂的类型,录入列表字典和对象--> | ||
<!-- <p>A value from a dictionary:{{ mydict['key'] }}</p> | ||
<p>A value from a list:{{ mylist[3] }}</p> | ||
<p>A value from a list, with a variable index:{{ mylist[myintvar] }}</p> | ||
<p>A value from an object's method:{{ myobj.somemethod() }}</p> --> | ||
<!--即使{\{ . }\}已被html注释 注释掉,仍会识别,所以对于注释内容要打乱{\{ . }\}格式--> | ||
<!-- <p>A value from a dictionary:{\{ mydict['key'] }\}</p> | ||
<p>A value from a list:{\{ mylist[3] }\}</p> | ||
<p>A value from a list, with a variable index:{\{ mylist[myintvar] }\}</p> | ||
<p>A value from an object's method:{\{ myobj.somemethod() }\}</p> --> | ||
|
||
<!--变量的值可以用过滤器修改--> | ||
<!-- <h1>Hello {{ name|capitalize }}!</h1> --> | ||
<!-- <h1>Hello {\{ name|capitalize }\}!</h1> --> | ||
|
||
<!--常用过滤器--> | ||
<!-- safe capitalize lower upper title trim striptags --> | ||
<!-- safe capitalize lower upper title trim striptags --> | ||
|
||
{% extends "bootstrap/base.html" %} | ||
|
||
{% block title %}Flasky{% endblock %} | ||
|
||
{% block navbar %} | ||
<div class="navbar navbar-inverse" role="navigation"> | ||
<div class="container"> | ||
<div class="navbar-header"> | ||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> | ||
<span class="sr-only">Toggle navigation</span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
</button> | ||
<a class="navbar-brand" href="/">Flasky</a> | ||
</div> | ||
<div class="navbar-collapse collapse"> | ||
<ul class="nav navbar-nav"> | ||
<li><a href="/">Home</a></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div class="container"> | ||
<div class="page-header"> | ||
<h1>Hello, {{ name }}!</h1> | ||
</div> | ||
</div> | ||
{% endblock %} |