From 522bc27f1c9748bf9c5b9947b0809a6746f8524d Mon Sep 17 00:00:00 2001 From: sametmax Date: Wed, 3 Jul 2013 11:12:12 +0200 Subject: [PATCH] Moved deployment scripts in a dedicated directory. Added an importable wsgi.py module (app.wsgi works only for Apache, and now imports wsgi.py) and a script for gunicorn. Settings file can now be specified using an environnement variable. --- zerobin/app.wsgi | 10 ---------- zerobin/routes.py | 7 +++++-- 2 files changed, 5 insertions(+), 12 deletions(-) delete mode 100644 zerobin/app.wsgi diff --git a/zerobin/app.wsgi b/zerobin/app.wsgi deleted file mode 100644 index ff42952..0000000 --- a/zerobin/app.wsgi +++ /dev/null @@ -1,10 +0,0 @@ - -import os, sys - -# make sure the zerobin module is in the PYTHON PATH and importable -ZEROBIN_PARENT_DIR = os.path.dirname(os.path.dirname(__file__)) -sys.path.insert(0, ZEROBIN_PARENT_DIR) - -# create the wsgi callable -from zerobin.routes import get_app -settings, application = get_app(compressed_static=True) \ No newline at end of file diff --git a/zerobin/routes.py b/zerobin/routes.py index b0cbab0..ab8ffaa 100644 --- a/zerobin/routes.py +++ b/zerobin/routes.py @@ -148,8 +148,11 @@ def get_app(debug=None, settings_file='', Return a tuple (settings, app) configured using passed parameters and/or a setting file. """ + + settings_file = settings_file or os.environ.get('ZEROBIN_SETTINGS_FILE') + if settings_file: - settings.update_with_file(os.path.abspath(settings_file)) + settings.update_with_file(os.path.realpath(settings_file)) if settings.PASTE_ID_LENGTH < 4: raise SettingsValidationError('PASTE_ID_LENGTH cannot be lower than 4') @@ -173,7 +176,7 @@ def get_app(debug=None, settings_file='', @clize.clize(coerce={'debug': bool, 'compressed_static': bool}) def runserver(host='', port='', debug=None, user='', group='', settings_file='', compressed_static=None, - version=False, paste_id_length=None): + version=False, paste_id_length=None, server="cherrypy"): if version: print '0bin V%s' % settings.VERSION