Skip to content

Commit

Permalink
Allow users to specify server ip
Browse files Browse the repository at this point in the history
Replace the deprecated option_list with add_arguments (new in Django
1.8). This allows users to specify a host ip address for the runserver
command.
  • Loading branch information
Daniel Crabtree committed Sep 5, 2015
1 parent 2eb61bf commit 6e1ffe6
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions livereload/management/commands/runserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,25 @@ class Command(RunserverCommand):
"""
Command for running the development server with LiveReload.
"""
option_list = RunserverCommand.option_list + (
make_option('--nolivereload', action='store_false',
dest='use_livereload', default=True,
help='Tells Django to NOT use LiveReload.'),
make_option('--livereload-port', action='store',
dest='livereload_port', default='35729',
help='Port where LiveReload listen.'),
)
if callable(getattr(RunserverCommand, 'add_arguments', None)):
def add_arguments(self, parser):
super(Command, self).add_arguments(parser)
parser.add_argument('--nolivereload', action='store_false',
dest='use_livereload', default=True,
help='Tells Django to NOT use LiveReload.')
parser.add_argument('--livereload-port', action='store',
dest='livereload_port', default='35729',
help='Port where LiveReload listen.')
else:
option_list = RunserverCommand.option_list + (
make_option('--nolivereload', action='store_false',
dest='use_livereload', default=True,
help='Tells Django to NOT use LiveReload.'),
make_option('--livereload-port', action='store',
dest='livereload_port', default='35729',
help='Port where LiveReload listen.'),
)

help = 'Starts a lightweight Web server for development with LiveReload.'

def message(self, message, verbosity=1, style=None):
Expand Down

0 comments on commit 6e1ffe6

Please sign in to comment.