Added --reload argument to 'immutabase serve' command

Uses hupper to restart the server when the code changes. Useful for development.

Depends on https://pypi.python.org/pypi/hupper
pull/81/head
Simon Willison 2017-11-09 05:46:16 -08:00
rodzic 8af7bc100c
commit abb591d832
2 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -21,8 +21,13 @@ def build(files):
@click.option('-h', '--host', default='0.0.0.0')
@click.option('-p', '--port', default=8001)
@click.option('--debug', is_flag=True)
def serve(files, host, port, debug):
@click.option('--reload', is_flag=True)
def serve(files, host, port, debug, reload):
"""Serve up specified database files with a web UI"""
if reload:
import hupper
hupper.start_reloader('immutabase.cli.serve')
click.echo('Serve! files={} on port {}'.format(files, port))
app = app_factory(files)
app.run(host=host, port=port, debug=debug)

Wyświetl plik

@ -11,6 +11,7 @@ setup(
'click-default-group==1.2',
'sanic==0.6.0',
'sanic-jinja2==0.5.5',
'hupper==1.0',
],
entry_points='''
[console_scripts]