rework documentation launch
This commit is contained in:
@@ -1,5 +1,28 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from pyramid.config import Configurator
|
||||||
|
from wsgiref.simple_server import make_server
|
||||||
|
|
||||||
|
docport = 8000
|
||||||
|
|
||||||
|
|
||||||
|
def website():
|
||||||
|
config = Configurator()
|
||||||
|
|
||||||
|
# Set up static file serving from the 'site/' directory
|
||||||
|
config.add_static_view(
|
||||||
|
name="/", path=os.path.join(os.getcwd(), "site"), cache_max_age=3600
|
||||||
|
)
|
||||||
|
|
||||||
|
app = config.make_wsgi_app()
|
||||||
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
def launch_documentation():
|
||||||
|
app = website()
|
||||||
|
server = make_server("localhost", docport, app)
|
||||||
|
print("Serving MkDocs documentation on http://0.0.0.0:{}".format(docport))
|
||||||
|
server.serve_forever()
|
||||||
|
|
||||||
|
|
||||||
def run_mkdocs():
|
def run_mkdocs():
|
||||||
@@ -9,7 +32,9 @@ def run_mkdocs():
|
|||||||
sys.stdout = devnull
|
sys.stdout = devnull
|
||||||
sys.stderr = devnull
|
sys.stderr = devnull
|
||||||
try:
|
try:
|
||||||
os.system("mkdocs serve -q")
|
launch_documentation()
|
||||||
|
except Exception as e:
|
||||||
|
print("Error occurred while launching documentation:", e)
|
||||||
finally:
|
finally:
|
||||||
sys.stdout = old_stdout
|
sys.stdout = old_stdout
|
||||||
sys.stderr = old_stderr
|
sys.stderr = old_stderr
|
||||||
|
|||||||
Reference in New Issue
Block a user