Skip to content

Commit

Permalink
Django 1.10 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Walch committed Sep 19, 2016
1 parent a99d1e9 commit 541ba9a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
9 changes: 8 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,21 @@ 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 = (
...
'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
Expand Down
2 changes: 1 addition & 1 deletion livereload/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""django-livereload"""
__version__ = '0.2.2'
__version__ = '0.2.3'
__license__ = 'BSD License'

__author__ = 'Tomas Walch'
Expand Down
7 changes: 6 additions & 1 deletion livereload/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down

0 comments on commit 541ba9a

Please sign in to comment.