Commit graph

12 commits

Author SHA1 Message Date
Simon Willison
6b3b05b6db Released 0.7 2017-11-13 10:42:30 -08:00
Simon Willison
97c4bf4271 Added --cors argument to enable CORS
Closes #75
2017-11-13 10:17:42 -08:00
Simon Willison
4143e3b45c New command: datasette package - packages a docker container
Example usage:

    datasette package fivethirtyeight.db \
        --tag fivethirtyeight \
        --metadata=538-metadata.json

This will create a temporary directory, generate a Dockerfile, copy in the
SQLite database and metadata file, then build that as a new docker image and
tag that in your local Docker repository as fivethirtyeight:latest.

You can then run the image like so:

    docker run -p 8006:8001 fivethirtyeight

This will expose port 8001 in the container (the default) as port 8006 on your
host.

Closes #67
2017-11-13 08:17:35 -08:00
Simon Willison
3ef35ca8b4 serve and publish commands now take a --metadata option
If provided, the --metadata option is the path to a JSON file containing
metadata that should be displayed alongside the dataset.

    datasette /tmp/fivethirtyeight.db --metadata /tmp/metadata.json

Currently that metadata format looks like this:

    {
        "title": "Five Thirty Eight",
        "license": "CC Attribution 4.0 License",
        "license_url": "http://creativecommons.org/licenses/by/4.0/",
        "source": "fivethirtyeight/data on GitHub",
        "source_url": "https://github.com/fivethirtyeight/data"
    }

If provided, this will be used by the index template and to populate the
common footer.

The publish command also accepts this argument, and will package any provided
metadata up and include it with the resulting Docker container.

    datasette publish --metadata /tmp/metadata.json /tmp/fivethirtyeight.db

Closes #68
2017-11-13 07:20:02 -08:00
Simon Willison
2bbe9ca34a Support OPTIONS requests for CORS 2017-11-12 18:11:52 -08:00
Simon Willison
26370b14d8 Handle table names with slashes in them
e.g. https://datasette-wdlexdiaoz.now.sh/fivethirtyeight-75d605c/bob-ross%2Felements-by-episode.csv?CABIN=1&BUSHES=1&CLOUDS=1
2017-11-12 15:17:00 -08:00
Simon Willison
2366a016f2 Added links to .json and .jsono representations
Closes #62
2017-11-11 14:40:44 -08:00
Simon Willison
40a563ebac Reworked metadata building options
Building metadata is now optional. If you want to do it, do this:

    datasette build *.db --metadata=metadata.json

Then when you run the server you can tell it to read from metadata:

    datasette serve *.db --metadata=metadata.json

The Dockerfile generated by datasette publish now uses this mechanism.

Closes #60
2017-11-11 12:11:51 -08:00
Simon Willison
65e350ca2a Implemented 'datasette publish one.db two.db' command
Closes #26
2017-11-10 23:25:22 -08:00
Simon Willison
7d81083d40 Implemented responsive tables, removed bootstrap
No need for all of bootstrap since we only need to style a few elements.

Implemented responsive table pattern from here:
https://css-tricks.com/responsive-data-tables/

Refs #16
2017-11-10 21:55:50 -08:00
Simon Willison
21c9c04310 Implemented cursor-based pagination for table view
Closes #5
2017-11-10 12:41:14 -08:00
Simon Willison
a8a293cd71 Refactored util functions into new utils module 2017-11-10 11:25:54 -08:00