From f886d86b465484bb34d2efd90e14ec2f564545f9 Mon Sep 17 00:00:00 2001 From: benoitc Date: Tue, 27 Aug 2013 21:17:33 +0200 Subject: [PATCH] deprecate gunicorn_django --- gunicorn/app/base.py | 1 - gunicorn/app/djangoapp.py | 9 +++++++++ gunicorn/util.py | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gunicorn/app/base.py b/gunicorn/app/base.py index c2ced986..21f07081 100644 --- a/gunicorn/app/base.py +++ b/gunicorn/app/base.py @@ -13,7 +13,6 @@ from gunicorn.config import Config, get_default_config_file from gunicorn import debug from gunicorn.six import execfile_ - class Application(object): """\ An application interface for configuring and loading diff --git a/gunicorn/app/djangoapp.py b/gunicorn/app/djangoapp.py index 7c4696f6..6f7dbee1 100644 --- a/gunicorn/app/djangoapp.py +++ b/gunicorn/app/djangoapp.py @@ -147,5 +147,14 @@ def run(): The ``gunicorn_django`` command line runner for launching Django applications. """ + util.warn("""This command is deprecated. + + You should now run your application with the WSGI interface + installed with your project. Ex.: + + gunicorn myproject.wsgi:application + + See https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/gunicorn/ + for more info.""") from gunicorn.app.djangoapp import DjangoApplication DjangoApplication("%(prog)s [OPTIONS] [SETTINGS_PATH]").run() diff --git a/gunicorn/util.py b/gunicorn/util.py index e4cf0d31..d632b2c4 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -509,6 +509,7 @@ def to_bytestring(value): assert isinstance(value, text_type) return value.encode("utf-8") + def is_fileobject(obj): if not hasattr(obj, "tell") or not hasattr(obj, "fileno"): return False @@ -520,3 +521,16 @@ def is_fileobject(obj): return False return True + + +def warn(msg): + sys.stderr.write("!!!\n") + + lines = msg.splitlines() + for i, line in enumerate(lines): + if i == 0: + line = "WARNING: %s" % line + sys.stderr.write("!!! %s\n" % line) + + sys.stderr.write("!!!\n\n") + sys.stderr.flush()