rework documentation launch

This commit is contained in:
2025-07-02 08:30:56 +02:00
parent 5eccbebef7
commit cd255696f0

View File

@@ -1,5 +1,28 @@
import os
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():
@@ -9,7 +32,9 @@ def run_mkdocs():
sys.stdout = devnull
sys.stderr = devnull
try:
os.system("mkdocs serve -q")
launch_documentation()
except Exception as e:
print("Error occurred while launching documentation:", e)
finally:
sys.stdout = old_stdout
sys.stderr = old_stderr