husk/freezer.py

25 lines
611 B
Python
Raw Normal View History

2022-09-02 09:05:59 +02:00
from flask_frozen import Freezer
from start_site import app, list_files
2022-09-09 15:41:05 +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"]
2022-09-02 09:05:59 +02:00
freezer = Freezer(app)
_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
@freezer.register_generator
def content():
for _file in _files:
2022-11-02 22:46:19 +01: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!")
2022-09-02 09:05:59 +02:00
#freezer.run(debug=True)