mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
I'm using click, and click recommends using a setup.py - so I've added one of those. I also refactored code into a new datasite package. It's not quite deploying to now properly at the moment though - I seem to have messed up the path handling a bit. Also snuck in a new template for the "Row" view. Refs #40
24 lines
597 B
Python
24 lines
597 B
Python
import click
|
|
from .app import app, ensure_build_metadata
|
|
|
|
@click.group()
|
|
def cli():
|
|
"""
|
|
Datasite!
|
|
"""
|
|
|
|
|
|
@cli.command()
|
|
def build():
|
|
ensure_build_metadata(True)
|
|
|
|
|
|
@cli.command()
|
|
@click.argument('files', type=click.Path(exists=True), nargs=-1)
|
|
@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):
|
|
'''Serve up specified database files with a web UI'''
|
|
click.echo('Serve! files={} on port {}'.format(files, port))
|
|
app.run(host=host, port=port, debug=debug)
|