From: Frédéric Péters Date: Thu, 13 Aug 2015 08:51:00 +0000 (+0200) Subject: serve some static files using WhiteNoise X-Git-Url: https://git.0d.be/?p=wcs-on-openshift.git;a=commitdiff_plain;h=HEAD serve some static files using WhiteNoise --- diff --git a/requirements.txt b/requirements.txt index cf3264b..4e7e0ae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ quixote +whitenoise diff --git a/wsgi.py b/wsgi.py index 52e5229..9dc3bae 100644 --- a/wsgi.py +++ b/wsgi.py @@ -14,6 +14,8 @@ if 'OPENSHIFT_PYTHON_DIR' in os.environ: # line, it's possible required libraries won't be in your searchable path # +from whitenoise import WhiteNoise + BASE_WCS_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'wcs') sys.path.append(BASE_WCS_DIR) if os.path.exists(os.path.join(BASE_WCS_DIR, 'data/vendor/effective_tld_names.dat')): @@ -49,8 +51,8 @@ publisher.WcsPublisher.APP_DIR = os.environ.get('OPENSHIFT_DATA_DIR', '/tmp/') publisher.WcsPublisher.DATA_DIR = os.path.join(BASE_WCS_DIR, 'data') pub = publisher.WcsPublisher.create_publisher(register_cron=False) -application = QWIP(pub) - +application = WhiteNoise(QWIP(pub)) +application.add_files(os.path.join(BASE_WCS_DIR, 'wcs/qommon/static'), 'qo') if __name__ == '__main__': from wsgiref.simple_server import make_server