husk/freezer.py

25 lines
611 B
Python

from flask_frozen import Freezer
from start_site import app, list_files
#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)