Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/datasette/datasette-short-links
Work-in-progress URL shortener for Datasette
https://github.com/datasette/datasette-short-links
Last synced: about 2 months ago
JSON representation
Work-in-progress URL shortener for Datasette
- Host: GitHub
- URL: https://github.com/datasette/datasette-short-links
- Owner: datasette
- License: apache-2.0
- Created: 2023-09-01T00:54:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-08T19:20:01.000Z (over 1 year ago)
- Last Synced: 2024-10-14T01:11:41.892Z (3 months ago)
- Language: Python
- Size: 22.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# datasette-short-links
[![PyPI](https://img.shields.io/pypi/v/datasette-short-links.svg)](https://pypi.org/project/datasette-short-links/)
[![Changelog](https://img.shields.io/github/v/release/datasette/datasette-short-links?include_prereleases&label=changelog)](https://github.com/datasette/datasette-short-links/releases)
[![Tests](https://github.com/datasette/datasette-short-links/workflows/Test/badge.svg)](https://github.com/datasette/datasette-short-links/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/datasette/datasette-short-links/blob/main/LICENSE)A URL link shortener for Datasette. Work in progress!
## Installation
This plugin requires an alpha version of Datasette 1.0, because it uses [Datasette's internal database](https://docs.datasette.io/en/latest/internals.html#internals-internal) introduced in `1.0a5`.
pip install datasette==1.0a5
After than, you can install this plugin in the same environment as Datasette.
datasette install datasette-short-links
## Usage
Once installed, the bottom of each page with have a "Copy URL" button at the bottom of that page. That URL will link directly back to the same page.
A short URL will look something like: `http://localhost:8001/-/l/01h973jcqspxrhzy00zebhx748`
To take full advantage of this plugin, use a persistent internal database to store links even after your Datasette instance exits. This can be done with the `--internal` flag:
```
datasette --internal internal.db my_data.db
```## Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-short-links
python3 -m venv venv
source venv/bin/activateNow install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest