| 1 |
<img src="https://datasette.io/static/datasette-logo.svg" alt="Datasette"> |
| 2 |
|
| 3 |
[](https://pypi.org/project/datasette/) |
| 4 |
[](https://docs.datasette.io/en/stable/changelog.html) |
| 5 |
[](https://pypi.org/project/datasette/) |
| 6 |
[](https://github.com/simonw/datasette/actions?query=workflow%3ATest) |
| 7 |
[](https://docs.datasette.io/en/latest/?badge=latest) |
| 8 |
[](https://github.com/simonw/datasette/blob/main/LICENSE) |
| 9 |
[](https://hub.docker.com/r/datasetteproject/datasette) |
| 10 |
[](https://discord.gg/ktd74dm5mw) |
| 11 |
|
| 12 |
*An open source multi-tool for exploring and publishing data* |
| 13 |
|
| 14 |
Datasette is a tool for exploring and publishing data. It helps people take data of any shape or size and publish that as an interactive, explorable website and accompanying API. |
| 15 |
|
| 16 |
Datasette is aimed at data journalists, museum curators, archivists, local governments, scientists, researchers and anyone else who has data that they wish to share with the world. |
| 17 |
|
| 18 |
[Explore a demo](https://global-power-plants.datasettes.com/global-power-plants/global-power-plants), watch [a video about the project](https://simonwillison.net/2021/Feb/7/video/) or try it out by [uploading and publishing your own CSV data](https://docs.datasette.io/en/stable/getting_started.html#try-datasette-without-installing-anything-using-glitch). |
| 19 |
|
| 20 |
* [datasette.io](https://datasette.io/) is the official project website |
| 21 |
* Latest [Datasette News](https://datasette.io/news) |
| 22 |
* Comprehensive documentation: https://docs.datasette.io/ |
| 23 |
* Examples: https://datasette.io/examples |
| 24 |
* Live demo of current `main` branch: https://latest.datasette.io/ |
| 25 |
* Questions, feedback or want to talk about the project? Join our [Discord](https://discord.gg/ktd74dm5mw) |
| 26 |
|
| 27 |
Want to stay up-to-date with the project? Subscribe to the [Datasette newsletter](https://datasette.substack.com/) for tips, tricks and news on what's new in the Datasette ecosystem. |
| 28 |
|
| 29 |
## Installation |
| 30 |
|
| 31 |
If you are on a Mac, [Homebrew](https://brew.sh/) is the easiest way to install Datasette: |
| 32 |
|
| 33 |
brew install datasette |
| 34 |
|
| 35 |
You can also install it using `pip` or `pipx`: |
| 36 |
|
| 37 |
pip install datasette |
| 38 |
|
| 39 |
Datasette requires Python 3.7 or higher. We also have [detailed installation instructions](https://docs.datasette.io/en/stable/installation.html) covering other options such as Docker. |
| 40 |
|
| 41 |
## Basic usage |
| 42 |
|
| 43 |
datasette serve path/to/database.db |
| 44 |
|
| 45 |
This will start a web server on port 8001 - visit http://localhost:8001/ to access the web interface. |
| 46 |
|
| 47 |
`serve` is the default subcommand, you can omit it if you like. |
| 48 |
|
| 49 |
Use Chrome on OS X? You can run datasette against your browser history like so: |
| 50 |
|
| 51 |
datasette ~/Library/Application\ Support/Google/Chrome/Default/History --nolock |
| 52 |
|
| 53 |
Now visiting http://localhost:8001/History/downloads will show you a web interface to browse your downloads data: |
| 54 |
|
| 55 |
 |
| 56 |
|
| 57 |
## metadata.json |
| 58 |
|
| 59 |
If you want to include licensing and source information in the generated datasette website you can do so using a JSON file that looks something like this: |
| 60 |
|
| 61 |
{ |
| 62 |
"title": "Five Thirty Eight", |
| 63 |
"license": "CC Attribution 4.0 License", |
| 64 |
"license_url": "http://creativecommons.org/licenses/by/4.0/", |
| 65 |
"source": "fivethirtyeight/data on GitHub", |
| 66 |
"source_url": "https://github.com/fivethirtyeight/data" |
| 67 |
} |
| 68 |
|
| 69 |
Save this in `metadata.json` and run Datasette like so: |
| 70 |
|
| 71 |
datasette serve fivethirtyeight.db -m metadata.json |
| 72 |
|
| 73 |
The license and source information will be displayed on the index page and in the footer. They will also be included in the JSON produced by the API. |
| 74 |
|
| 75 |
## datasette publish |
| 76 |
|
| 77 |
If you have [Heroku](https://heroku.com/) or [Google Cloud Run](https://cloud.google.com/run/) configured, Datasette can deploy one or more SQLite databases to the internet with a single command: |
| 78 |
|
| 79 |
datasette publish heroku database.db |
| 80 |
|
| 81 |
Or: |
| 82 |
|
| 83 |
datasette publish cloudrun database.db |
| 84 |
|
| 85 |
This will create a docker image containing both the datasette application and the specified SQLite database files. It will then deploy that image to Heroku or Cloud Run and give you a URL to access the resulting website and API. |
| 86 |
|
| 87 |
See [Publishing data](https://docs.datasette.io/en/stable/publish.html) in the documentation for more details. |
| 88 |
|
| 89 |
## Datasette Lite |
| 90 |
|
| 91 |
[Datasette Lite](https://lite.datasette.io/) is Datasette packaged using WebAssembly so that it runs entirely in your browser, no Python web application server required. Read more about that in the [Datasette Lite documentation](https://github.com/simonw/datasette-lite/blob/main/README.md). |