mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
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.
This commit is contained in:
parent
9e48029ef9
commit
522bc27f1c
@ -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)
|
|
@ -148,8 +148,11 @@ def get_app(debug=None, settings_file='',
|
|||||||
Return a tuple (settings, app) configured using passed
|
Return a tuple (settings, app) configured using passed
|
||||||
parameters and/or a setting file.
|
parameters and/or a setting file.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
settings_file = settings_file or os.environ.get('ZEROBIN_SETTINGS_FILE')
|
||||||
|
|
||||||
if 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:
|
if settings.PASTE_ID_LENGTH < 4:
|
||||||
raise SettingsValidationError('PASTE_ID_LENGTH cannot be lower than 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})
|
@clize.clize(coerce={'debug': bool, 'compressed_static': bool})
|
||||||
def runserver(host='', port='', debug=None, user='', group='',
|
def runserver(host='', port='', debug=None, user='', group='',
|
||||||
settings_file='', compressed_static=None,
|
settings_file='', compressed_static=None,
|
||||||
version=False, paste_id_length=None):
|
version=False, paste_id_length=None, server="cherrypy"):
|
||||||
|
|
||||||
if version:
|
if version:
|
||||||
print '0bin V%s' % settings.VERSION
|
print '0bin V%s' % settings.VERSION
|
||||||
|
Loading…
Reference in New Issue
Block a user