diff --git a/README.rst b/README.rst index 606b17d..9d68f71 100644 --- a/README.rst +++ b/README.rst @@ -20,7 +20,7 @@ Add ``'livereload'`` to the ``INSTALLED_APPS``, before ``'django.contrib.staticf ... ) -Add ``'livereload.middleware.LiveReloadScript'`` to the +Add ``'livereload.middleware.LiveReloadScript'`` to ``MIDDLEWARE_CLASSES`` (probably at the end):: MIDDLEWARE_CLASSES = ( @@ -28,6 +28,13 @@ Add ``'livereload.middleware.LiveReloadScript'`` to the 'livereload.middleware.LiveReloadScript', ) +Or to ``MIDDLEWARE`` for Django >= 1.10:: + + MIDDLEWARE = [ + ... + 'livereload.middleware.LiveReloadScript', + ] + This will inject the ``livereload.js`` script into your webpages if ``DEBUG`` setting is on. Configuration diff --git a/livereload/__init__.py b/livereload/__init__.py index 357a644..60a8a31 100644 --- a/livereload/__init__.py +++ b/livereload/__init__.py @@ -1,5 +1,5 @@ """django-livereload""" -__version__ = '0.2.2' +__version__ = '0.2.3' __license__ = 'BSD License' __author__ = 'Tomas Walch' diff --git a/livereload/middleware.py b/livereload/middleware.py index fe9a9ac..df69f29 100644 --- a/livereload/middleware.py +++ b/livereload/middleware.py @@ -5,10 +5,15 @@ from django.utils.encoding import smart_str from django.conf import settings +try: + from django.utils.deprecation import MiddlewareMixin +except ImportError: + MiddlewareMixin = object + from livereload import livereload_port, livereload_host -class LiveReloadScript(object): +class LiveReloadScript(MiddlewareMixin): """ Injects the live-reload script into your webpages. """