Skip to content

Commit

Permalink
Try using --config base_url and absolute_url: True
Browse files Browse the repository at this point in the history
Also formatted using Black. Refs #1.
  • Loading branch information
simonw authored Mar 25, 2020
1 parent 12c7869 commit d1a489d
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions nbdatasette.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import os


def setup_datasette():
dbpath = os.path.join(os.environ['HOME'], 'dakar_sql.sqlite')
return {
#datasette does look like it supports static references, but I'm missing something somewhere?
# https://github.com/simonw/datasette/issues/160
#If we set static refererncing, do we also need ;absolute_url': False ?
#I may (also) be misunderstanding {base_url}. Is that the domain, the domain+path, or the path?
#If it's the path, then can it be used to set the static element (once I figure out what args --static takes)
#I am so in the land of so-tired I have no idea what anything does.
#'command': ['datasette', 'serve', '-p', '{port}', '--static', 'static:{base_url}', dbpath],
'command': ['datasette', 'serve', '-p', '{port}', dbpath],
#With absolute_url True we get infinite redirects?
'absolute_url': False,
#The following needs a the labextension installing.
#eg in postBuild: jupyter labextension install jupyterlab-server-proxy
'launcher_entry': {
'enabled': True,
#'icon_path': '/home/jovyan/.jupyter/datasette.svg',
'title': 'Datasette',
},
}
dbpath = os.path.join(os.environ["HOME"], "dakar_sql.sqlite")
return {
"command": [
"datasette",
"serve",
"-p",
"{port}",
"--config",
"base_url:{base_url}",
dbpath,
],
"absolute_url": True,
# The following needs a the labextension installing.
# eg in postBuild: jupyter labextension install jupyterlab-server-proxy
"launcher_entry": {
"enabled": True,
#'icon_path': '/home/jovyan/.jupyter/datasette.svg',
"title": "Datasette",
},
}

0 comments on commit d1a489d

Please sign in to comment.