Cleaning
This commit is contained in:
1 parent
777996cb40
commit
b9d19368f1
91 files changed
+25
-47569
No files matched your search
@@ -4,7 +4,7 @@
|
||||
Stdlib only, so the container needs nothing but a Python base image.
|
||||
|
||||
It serves two directories as one origin: assets/, which is hand-written, and
|
||||
books/, which utils/compile_bible.py generates from source/. Nothing is copied
|
||||
bible/, which utils/compile_bible.py generates from source/. Nothing is copied
|
||||
between them -- every file exists once, in the directory that owns it.
|
||||
|
||||
Beyond serving files it has three jobs.
|
||||
@@ -101,7 +101,7 @@ def digest(files):
|
||||
def page_url(rel):
|
||||
"""The address a served file answers to.
|
||||
|
||||
books/GEN.html is ./GEN, and books/index.html is the root itself -- there
|
||||
bible/GEN.html is ./GEN, and bible/index.html is the root itself -- there
|
||||
is no /index, the book list lives at /.
|
||||
"""
|
||||
if rel == "index.html":
|
||||
@@ -122,7 +122,7 @@ def stamp_worker(roots):
|
||||
LIBRARY is the list the worker downloads in the background. Stamped rather
|
||||
than written by hand for the same reason the versions are: what is on disk
|
||||
is the only honest source, and there is no build step to ask. It is written
|
||||
in the URL space, not the disk one -- books/GEN.html is "./GEN" and the
|
||||
in the URL space, not the disk one -- bible/GEN.html is "./GEN" and the
|
||||
book list is "./" -- so that the worker caches a page under the address the
|
||||
reader actually asks for.
|
||||
"""
|
||||
@@ -251,12 +251,12 @@ def main(argv=None):
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
ap.add_argument("--root", action="append", dest="roots", metavar="DIR",
|
||||
help="directory to serve; repeatable, earlier wins "
|
||||
"(default: assets then books, or $SITE_ROOTS)")
|
||||
"(default: assets then bible, or $SITE_ROOTS)")
|
||||
ap.add_argument("--host", default=os.environ.get("HOST", "0.0.0.0"))
|
||||
ap.add_argument("--port", type=int, default=int(os.environ.get("PORT", "8080")))
|
||||
args = ap.parse_args(argv)
|
||||
|
||||
names = args.roots or os.environ.get("SITE_ROOTS", "assets:books").split(":")
|
||||
names = args.roots or os.environ.get("SITE_ROOTS", "assets:bible").split(":")
|
||||
roots = tuple(os.path.abspath(name) for name in names if name)
|
||||
for root in roots:
|
||||
if not os.path.isdir(root):
|
||||
|
||||
Reference in new issue
Block a user