kopia lustrzana https://github.com/simonw/datasette
rodzic
80bf3afa43
commit
0539905806
|
@ -105,7 +105,7 @@ http://localhost:8001/History/downloads.jsono will return that data as JSON in a
|
||||||
--sql_time_limit_ms INTEGER Max time allowed for SQL queries in ms
|
--sql_time_limit_ms INTEGER Max time allowed for SQL queries in ms
|
||||||
--load-extension TEXT Path to a SQLite extension to load
|
--load-extension TEXT Path to a SQLite extension to load
|
||||||
--inspect-file TEXT Path to JSON file created using "datasette
|
--inspect-file TEXT Path to JSON file created using "datasette
|
||||||
build"
|
inspect"
|
||||||
-m, --metadata FILENAME Path to JSON file containing license/source
|
-m, --metadata FILENAME Path to JSON file containing license/source
|
||||||
metadata
|
metadata
|
||||||
--help Show this message and exit.
|
--help Show this message and exit.
|
||||||
|
@ -199,7 +199,7 @@ Here's example output for the package command:
|
||||||
Step 4/7 : RUN pip install datasette
|
Step 4/7 : RUN pip install datasette
|
||||||
---> Using cache
|
---> Using cache
|
||||||
---> 340efa82bfd7
|
---> 340efa82bfd7
|
||||||
Step 5/7 : RUN datasette build parlgov.db --inspect-file inspect-data.json
|
Step 5/7 : RUN datasette inspect parlgov.db --inspect-file inspect-data.json
|
||||||
---> Using cache
|
---> Using cache
|
||||||
---> 5fddbe990314
|
---> 5fddbe990314
|
||||||
Step 6/7 : EXPOSE 8001
|
Step 6/7 : EXPOSE 8001
|
||||||
|
|
|
@ -26,7 +26,7 @@ def cli():
|
||||||
'sqlite_extensions', '--load-extension', envvar='SQLITE_EXTENSIONS', multiple=True,
|
'sqlite_extensions', '--load-extension', envvar='SQLITE_EXTENSIONS', multiple=True,
|
||||||
type=click.Path(exists=True, resolve_path=True), help='Path to a SQLite extension to load'
|
type=click.Path(exists=True, resolve_path=True), help='Path to a SQLite extension to load'
|
||||||
)
|
)
|
||||||
def build(files, inspect_file, sqlite_extensions):
|
def inspect(files, inspect_file, sqlite_extensions):
|
||||||
app = Datasette(files, sqlite_extensions=sqlite_extensions)
|
app = Datasette(files, sqlite_extensions=sqlite_extensions)
|
||||||
open(inspect_file, 'w').write(json.dumps(app.inspect(), indent=2))
|
open(inspect_file, 'w').write(json.dumps(app.inspect(), indent=2))
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ class StaticMount(click.ParamType):
|
||||||
'sqlite_extensions', '--load-extension', envvar='SQLITE_EXTENSIONS', multiple=True,
|
'sqlite_extensions', '--load-extension', envvar='SQLITE_EXTENSIONS', multiple=True,
|
||||||
type=click.Path(exists=True, resolve_path=True), help='Path to a SQLite extension to load'
|
type=click.Path(exists=True, resolve_path=True), help='Path to a SQLite extension to load'
|
||||||
)
|
)
|
||||||
@click.option('--inspect-file', help='Path to JSON file created using "datasette build"')
|
@click.option('--inspect-file', help='Path to JSON file created using "datasette inspect"')
|
||||||
@click.option('-m', '--metadata', type=click.File(mode='r'), help='Path to JSON file containing license/source metadata')
|
@click.option('-m', '--metadata', type=click.File(mode='r'), help='Path to JSON file containing license/source metadata')
|
||||||
@click.option('-t', '--template-dir', type=click.Path(exists=True, file_okay=False, dir_okay=True), help='Path to directory containing custom templates')
|
@click.option('-t', '--template-dir', type=click.Path(exists=True, file_okay=False, dir_okay=True), help='Path to directory containing custom templates')
|
||||||
@click.option('-s', '--static', type=StaticMount(), help='mountpoint:path-to-directory for serving static files', multiple=True)
|
@click.option('-s', '--static', type=StaticMount(), help='mountpoint:path-to-directory for serving static files', multiple=True)
|
||||||
|
|
|
@ -150,7 +150,7 @@ FROM python:3
|
||||||
COPY . /app
|
COPY . /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN pip install {install_from}
|
RUN pip install {install_from}
|
||||||
RUN datasette build {files} --inspect-file inspect-data.json
|
RUN datasette inspect {files} --inspect-file inspect-data.json
|
||||||
EXPOSE 8001
|
EXPOSE 8001
|
||||||
CMD [{cmd}]'''.format(
|
CMD [{cmd}]'''.format(
|
||||||
files=' '.join(files),
|
files=' '.join(files),
|
||||||
|
@ -232,7 +232,7 @@ def temporary_heroku_directory(files, name, metadata, extra_options, branch=None
|
||||||
|
|
||||||
open('requirements.txt', 'w').write(install_from)
|
open('requirements.txt', 'w').write(install_from)
|
||||||
os.mkdir('bin')
|
os.mkdir('bin')
|
||||||
open('bin/post_compile', 'w').write('datasette build --inspect-file inspect-data.json')
|
open('bin/post_compile', 'w').write('datasette inspect --inspect-file inspect-data.json')
|
||||||
|
|
||||||
quoted_files = " ".join(map(shlex.quote, files))
|
quoted_files = " ".join(map(shlex.quote, files))
|
||||||
procfile_cmd = 'web: datasette serve --host 0.0.0.0 {quoted_files} --cors --port $PORT --inspect-file inspect-data.json'.format(
|
procfile_cmd = 'web: datasette serve --host 0.0.0.0 {quoted_files} --cors --port $PORT --inspect-file inspect-data.json'.format(
|
||||||
|
|
Ładowanie…
Reference in New Issue