husk/freezer.py

28 lines
657 B
Python
Raw Permalink Normal View History

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