-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrender_templates.py
57 lines (46 loc) · 1.63 KB
/
render_templates.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is a minimal example of a Flask application that renders an actual HTML
document. Run it using ::
python render_templates.py
Open your browser and head to http://127.0.0.1:5000/ and look at the result.
"""
from flask import Flask, render_template_string
app = Flask(__name__)
template_string = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello, World!</title>
<!-- Bootstrap CSS -->
<link href="{{ url_for('static', filename='css/bootstrap.css') }}" rel="stylesheet">
</head>
<body>
<div class="container">
<h1>Hello, World!</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
</p>
</div>
<!-- jQuery -->
<script src="{{ url_for('static', filename='js/jquery.js') }}"></script>
<!-- Bootstrap JS -->
<script src="{{ url_for('static', filename='js/bootstrap.js') }}"></script>
</body>
</html>
"""
@app.route('/')
def index():
return render_template_string(template_string)
if __name__ == '__main__':
app.run()