-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserve.py
More file actions
26 lines (21 loc) · 747 Bytes
/
serve.py
File metadata and controls
26 lines (21 loc) · 747 Bytes
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
import os
import time
from livereload import Server, shell
import build_site
def run_build():
print(f"\n[Watcher] Change detected at {time.strftime('%H:%M:%S')}")
try:
build_site.build()
print("[Watcher] Build successful.")
except Exception as e:
print(f"[Watcher] Build error: {e}")
if __name__ == "__main__":
build_site.build()
server = Server()
server.watch("ctfs/", run_build)
server.watch("templates/", run_build)
server.watch("static/", run_build)
server.watch("authors.yml", run_build)
server.watch("build_site.py", run_build)
print("[System] Starting LiveReload server on http://localhost:8000")
server.serve(root=str(build_site.SITE), port=8000, host="0.0.0.0")