diff --git a/pulsar/web/wsgi.py b/pulsar/web/wsgi.py index 3bd7643c..6765c72c 100644 --- a/pulsar/web/wsgi.py +++ b/pulsar/web/wsgi.py @@ -1,6 +1,7 @@ import atexit import inspect import logging +import os import pulsar.web.routes from pulsar.core import PulsarApp @@ -10,11 +11,14 @@ log = logging.getLogger(__name__) -def app_factory(global_conf, **local_conf): +def app_factory(global_conf=None, **local_conf): """ Returns the Pulsar WSGI application. """ - configuration_file = global_conf.get("__file__", None) + if global_conf: + configuration_file = global_conf.get("__file__") + else: + configuration_file = os.environ.get("PULSAR_CONFIG_FILE") webapp = init_webapp(ini_path=configuration_file, local_conf=local_conf) return webapp diff --git a/scripts/pulsar b/scripts/pulsar index f6908cdf..c217b067 100755 --- a/scripts/pulsar +++ b/scripts/pulsar @@ -117,7 +117,7 @@ then elif hash chaussette 2>/dev/null; then MODE="chaussette" else - MODE="paster" + MODE="granian" fi fi @@ -129,9 +129,9 @@ elif [ "$MODE" == "circusd" ]; then elif [ "$MODE" == "chaussette" ]; then echo "Attempting to use chaussette instead of paster, you must specify port on command-line (--port 8913)." chaussette "paste:$PULSAR_CONFIG_FILE" "$@" -elif [ "$MODE" == "paster" ]; then - echo "Starting pulsar with command [paster server \"$PULSAR_CONFIG_FILE\" \"$@\"]" - paster serve "$PULSAR_CONFIG_FILE" "$@" +elif [ "$MODE" == "granian" ]; then + echo "Starting pulsar with command [PULSAR_CONFIG_FILE=\"$PULSAR_CONFIG_FILE\" granian --access-log --interface wsgi --factory "pulsar.web.wsgi:app_factory" \"$PULSAR_CONFIG_FILE\" \"$@\"]" + PULSAR_CONFIG_FILE="$PULSAR_CONFIG_FILE" granian --access-log --interface wsgi --factory "pulsar.web.wsgi:app_factory" "$@" elif [ "$MODE" == "webless" ]; then if hash pulsar-main 2>/dev/null; then # Running from pip install since diff --git a/setup.py b/setup.py index 68faeed3..2f9d3986 100644 --- a/setup.py +++ b/setup.py @@ -107,7 +107,7 @@ install_requires=requirements, extras_require={ 'amqp': ['kombu'], - 'web': ['Paste', 'PasteScript'], + 'web': ['granian'], 'galaxy_extended_metadata': ['galaxy-job-execution', 'galaxy-util[template]'], }, license="Apache License 2.0",