rework documentation launch, use generated files instead of pure mkdocs, add quiet handler for use with logging in terminal
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
import os
|
||||
import sys
|
||||
from pyramid.config import Configurator
|
||||
from wsgiref.simple_server import make_server
|
||||
from wsgiref.simple_server import make_server, WSGIRequestHandler
|
||||
|
||||
docport = 8000
|
||||
|
||||
class QuietHandler(WSGIRequestHandler):
|
||||
# suppress “GET /…” access log
|
||||
def log_request(self, code="-", size="-"):
|
||||
pass
|
||||
|
||||
# suppress all other messages (errors, etc.)
|
||||
def log_message(self, fmt, *args):
|
||||
pass
|
||||
|
||||
def website():
|
||||
config = Configurator()
|
||||
@@ -20,7 +28,7 @@ def website():
|
||||
|
||||
def launch_documentation():
|
||||
app = website()
|
||||
server = make_server("localhost", docport, app)
|
||||
server = make_server("localhost", docport, app, handler_class=QuietHandler)
|
||||
print("Serving MkDocs documentation on http://0.0.0.0:{}".format(docport))
|
||||
server.serve_forever()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user