selfname=$(basename "$0")
local_bin="./bin"
-# Test whether or not gunicorn is installed
-# -----------------------------------------
-if [ -f "${local_bin}/python" ]; then
- our_python="${local_bin}/python";
-else
- our_python="python";
-fi
-
-if $our_python -c "import sys
-try:
- import gunicorn
- sys.exit(0)
-except ImportError:
- sys.exit(1)
-"; then
- use_gunicorn=true;
-else
- use_gunicorn=false;
-fi
-# -----------------------------------------
-
case "$selfname" in
lazyserver.sh)
- if $use_gunicorn; then
- starter_cmd=gunicorn;
- else
- starter_cmd=paster;
- fi
+ starter_cmd=paster;
ini_prefix=paste
;;
lazycelery.sh)
if [ "$1" = "-h" ]; then
echo "$0 [-h] [-c filename.ini] [ARGS_to_${starter_cmd} ...]"
echo ""
- if $use_gunicorn; then
- echo " For Gunicorn settings, see at:"
- echo " http://docs.gunicorn.org/en/19.0/settings.html"
- else
- echo " For example:"
- echo " $0 -c fcgi.ini port_number=23371"
- echo " or: $0 --server-name=fcgi --log-file=paste.log"
- fi
+ echo " For example:"
+ echo " $0 -c fcgi.ini port_number=23371"
+ echo " or: $0 --server-name=fcgi --log-file=paste.log"
echo ""
echo " The configfile defaults to ${ini_prefix}_local.ini,"
echo " if that is readable, otherwise ${ini_prefix}.ini."
export CELERY_ALWAYS_EAGER=true
case "$selfname" in
lazyserver.sh)
- if $use_gunicorn; then
- $starter --paste "$ini_file" --log-file=- $@;
- else
- $starter serve "$ini_file" "$@" --reload;
- fi
+ $starter serve "$ini_file" "$@" --reload;
;;
lazycelery.sh)
MEDIAGOBLIN_CONFIG="${ini_file}" \
mgoblin_app = hook_transform('wrap_wsgi', mgoblin_app)
return mgoblin_app
-
-
-def paste_server_selector(wsgi_app, global_config=None, **app_config):
- """
- Select between gunicorn and paste depending on what ia available
- """
- # See if we can import the gunicorn server...
- # otherwise we'll use the paste server
- try:
- import gunicorn
- except ImportError:
- gunicorn = None
-
- if gunicorn is None:
- # use paste
- from paste.httpserver import server_runner
-
- cleaned_app_config = dict(
- [(key, app_config[key])
- for key in app_config
- if key in ["host", "port", "handler", "ssl_pem", "ssl_context",
- "server_version", "protocol_version", "start_loop",
- "daemon_threads", "socket_timeout", "use_threadpool",
- "threadpool_workers", "threadpool_options",
- "request_queue_size"]])
-
- return server_runner(wsgi_app, global_config, **cleaned_app_config)
- else:
- # use gunicorn
- from gunicorn.app.pasterapp import PasterServerApplication
- return PasterServerApplication(wsgi_app, global_config, **app_config)
return loadapp(app_spec, name=name, relative_to=relative_to, **kwargs)
def daemonize(self):
- # TODO: pass to gunicorn if available
pass
def restart_with_reloader(self):
CELERY_ALWAYS_EAGER = true
[server:main]
-use = egg:gunicorn
+use = egg:waitress#main
host = 127.0.0.1
port = 6543
debug = false
[pipeline:main]
-pipeline = errors mediagoblin
+# pipeline = errors mediagoblin
+pipeline = mediagoblin
[app:mediagoblin]
use = egg:mediagoblin#app
# The server that is run by default.
# By default, should only be accessable locally
[server:main]
-use = egg:mediagoblin#paste_server_selector
+use = egg:waitress#main
host = 127.0.0.1
port = 6543
-# Gunicorn settings. See http://docs.gunicorn.org/en/19.0/settings.html
-# for more information about configuring Gunicorn
-proc_name = gmg
-reload = true
-accesslog = -
+# # Gunicorn settings. See http://docs.gunicorn.org/en/19.0/settings.html
+# # for more information about configuring Gunicorn
+# proc_name = gmg
+# reload = true
+# accesslog = -
#######################
# Helper server configs
# Use this if you want to run on port 6543 and have MediaGoblin be
# viewable externally
[server:broadcast]
-use = egg:Paste#http
+use = egg:waitress#main
host = 0.0.0.0
port = 6543
port = %(fcgi_port)s
[server:http]
-use = egg:Paste#http
+use = egg:waitress#main
host = %(http_host)s
port = %(http_port)s
pyversion_install_requires = []
if PY2:
pyversion_install_requires.append('argparse') # only for < 2.7
- pyversion_install_requires.append('PasteScript')
pyversion_install_requires.append('sqlalchemy-migrate>=0.9.6')
pyversion_install_requires.append('mock==1.0.1') # mock is in the stdlib for 3.3+
# PyPI version (1.4.2) does not have proper Python 3 support
pyversion_install_requires.append('ExifRead')
- pyversion_install_requires.append('Paste')
-else:
- pyversion_install_requires.append('gunicorn')
install_requires = [
+ 'waitress',
'alembic==0.6.6',
'python-dateutil',
'wtforms',