deprecate gunicorn_django

This commit is contained in:
benoitc 2013-08-27 21:17:33 +02:00
parent bdec5975ef
commit f886d86b46
3 changed files with 23 additions and 1 deletions

View File

@ -13,7 +13,6 @@ from gunicorn.config import Config, get_default_config_file
from gunicorn import debug from gunicorn import debug
from gunicorn.six import execfile_ from gunicorn.six import execfile_
class Application(object): class Application(object):
"""\ """\
An application interface for configuring and loading An application interface for configuring and loading

View File

@ -147,5 +147,14 @@ def run():
The ``gunicorn_django`` command line runner for launching Django The ``gunicorn_django`` command line runner for launching Django
applications. 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 from gunicorn.app.djangoapp import DjangoApplication
DjangoApplication("%(prog)s [OPTIONS] [SETTINGS_PATH]").run() DjangoApplication("%(prog)s [OPTIONS] [SETTINGS_PATH]").run()

View File

@ -509,6 +509,7 @@ def to_bytestring(value):
assert isinstance(value, text_type) assert isinstance(value, text_type)
return value.encode("utf-8") return value.encode("utf-8")
def is_fileobject(obj): def is_fileobject(obj):
if not hasattr(obj, "tell") or not hasattr(obj, "fileno"): if not hasattr(obj, "tell") or not hasattr(obj, "fileno"):
return False return False
@ -520,3 +521,16 @@ def is_fileobject(obj):
return False return False
return True 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()