Jelajahi Sumber

allow run_server.sh to work with python3.6

Marcelo Fornet 5 tahun lalu
induk
melakukan
84e67047a2
2 mengubah file dengan 10 tambahan dan 6 penghapusan
  1. 5 1
      run_server.sh
  2. 5 5
      sitegen.py

+ 5 - 1
run_server.sh

@@ -1,8 +1,12 @@
 #!/bin/bash
+
 python3 sitegen.py --with-index --watch &
 gen=$!
 
-python3 -m http.server -d build 8001 &
+sleep 1
+cd build
+
+python3 -m http.server 8001 &
 srv=$!
 
 trap "kill $gen; kill $srv" EXIT

+ 5 - 5
sitegen.py

@@ -149,7 +149,7 @@ def compile(env, path, target):
 
             dst = join(target, dst)
             dst_folder, _ = split(dst)
-            
+
             makedirs(dst_folder, exist_ok=True)
 
             template = env.get_template(join(cur_base, doc))
@@ -162,7 +162,7 @@ def init_gen(args):
     # Load layout
     file_loader = FileSystemLoader(args.source)
     env = args.env = Environment(loader=file_loader)
-    
+
     # Init gobals
     env.globals['lang'] = DEFAULT_LANG
 
@@ -217,7 +217,7 @@ def run(args):
 
     if not args.watch:
         return
-    
+
     print(f'watching {args.source}/*:{LANGUAGES}/*:{STATIC}/*:{ROOT}/*')
     while True:
         # take modification times
@@ -234,12 +234,12 @@ def run(args):
         if source_mt != new_source_mt:
             source_mt = new_source_mt
             save_generate(gen_layout, args, 'recompiling layout')
-        
+
         new_root_mt = mtimes(ROOT)
         if root_mt != new_root_mt:
             root_mt = new_root_mt
             save_generate(gen_root, args, 'copying root files')
-        
+
         new_static_mt = mtimes(STATIC)
         if static_mt != new_static_mt:
             static_mt = new_static_mt