From 12e7e763ac0c932165a445ec380df9718575dce3 Mon Sep 17 00:00:00 2001 From: Robbert Schep Date: Mon, 7 Jul 2025 13:32:30 +0200 Subject: [PATCH] feat: Add WSGI server and build config for Clever Cloud --- requirements.txt | 7 ++++++- server.py | 8 ++++++++ setup.py | 20 ++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 server.py create mode 100644 setup.py diff --git a/requirements.txt b/requirements.txt index 95bbdca..d44f9b9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,10 @@ -mkdocs-material +# For building the site mkdocs +mkdocs-material mkdocs-awesome-pages-plugin mkdocs-git-revision-date-plugin requests + +# For serving the site via WSGI on Clever Cloud +gunicorn +whitenoise diff --git a/server.py b/server.py new file mode 100644 index 0000000..aba793d --- /dev/null +++ b/server.py @@ -0,0 +1,8 @@ +# server.py +from whitenoise import WhiteNoise + +def not_found(environ, start_response): + start_response('404 NOT FOUND', [('Content-Type', 'text/plain')]) + return [b'Not Found'] + +application = WhiteNoise(not_found, root='site/', index_file=True) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..c91260f --- /dev/null +++ b/setup.py @@ -0,0 +1,20 @@ +# setup.py +import os +from setuptools import setup +from setuptools.command.install import install + +class BuildMkDocsCommand(install): + """Custom command to build the MkDocs site.""" + def run(self): + print("--> Running custom build command: mkdocs build") + os.system("mkdocs build") + print("--> MkDocs build complete.") + +setup( + name='smartup-zero-timeline', + version='1.0.0', + description='A wrapper to build and serve the MkDocs site on Clever Cloud.', + cmdclass={ + 'build_mkdocs': BuildMkDocsCommand, + } +)