Open plpxsk opened 3 years ago
A good reference seems to be the note to run datasette
as a module in https://github.com/simonw/datasette/pull/556
I've had a lot of success running it as an OpenFaaS lambda.
The following worked for deployment to RStudio / Posit Connect
An app.py along the lines of:
from pathlib import Path
from datasette.app import Datasette
example_db = Path(__file__).parent / "data" / "example.db"
# use connect 'Content URL' setting here to set app to /datasette/
ds = Datasette(files=[example_db], settings={"base_url": "/datasette/"})
ds._startup_invoked = True
ds_app = ds.app()
Then to deploy, from within a virtualenv with rsconnect-python
rsconnect write-manifest fastapi -p $VIRTUAL_ENV/bin/python -e app:ds_app -o .
rsconnect deploy manifest manifest.json -n <name of connect server> -t "Example Datasette"
All seems to work well, but there are some glitches to do with proxies, see #1883 .
Excited to use this :)
Is it possible to deploy a
datasette
application as a python web app?In my enterprise, I have option to deploy python apps via Rstudio Connect, and I would like to publish a
datasette
dashboard for sharing.I welcome any pointers to converting
datasette serve
into a python app that can be run as something likepython datasette.py --my_data.db