husk/freezer.py

28 lines
657 B
Python

from flask_frozen import Freezer
from start_site import app
from husk_helpers import list_files, cut_filetype_tree
# app.config["FREEZER_BASE_URL"] = "http://localhost/"
# app.config["FREEZER_RELATIVE_URLS"] = False
_path = app.config["husk"]["content"]["path"]
freezer = Freezer(app)
_files = list_files(_path)
_files = [file[len(_path):-len(".md")] for file in _files]
for file in _files:
print(f"[+] included {file}")
@freezer.register_generator
def content():
for _file in _files:
yield {"path": _file.encode('utf-8')}
if __name__ == '__main__':
freezer.freeze()
print("[*] Great Success!")
# freezer.run(debug=True)