-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfreeze.py
54 lines (41 loc) · 1.35 KB
/
freeze.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
from flask_frozen import Freezer
from app import app
import os
app.config['FREEZER_RELATIVE_URLS'] = True
freezer = Freezer(app)
@freezer.register_generator
def inicio():
yield '/index.html'
@freezer.register_generator
def post():
yield '/post.html'
@freezer.register_generator
def contactus():
yield "/contactus.html"
@freezer.register_generator
def aws():
yield "/aws-services.html"
@freezer.register_generator
def aws_service():
jpg_files = [f for f in os.listdir('static/img/aws') if f.endswith('.png')]
# sort files by name
jpg_files = sorted(jpg_files)
# For each element, select what is between - and .png
file_names = [f.split('.')[0] for f in jpg_files]
file_no_spaces = [f.replace(' ', '-') for f in file_names]
for file in file_no_spaces:
yield {'file': file}
@freezer.register_generator
def pubs():
# return render_template('aws-services/' + file)
jpg_files = [f for f in os.listdir('static/img/pubs/principal') if f.endswith('.jpg')]
# sort files by name
jpg_files = sorted(jpg_files, reverse=True)
# Get file names
file = [f.split('.')[0] for f in jpg_files]
file_names = [f.split('.')[0] for f in jpg_files]
for file in file_names:
yield {'file': file}
if __name__ == '__main__':
freezer.freeze()
# freezer.run(debug=True)