{"html_url": "https://github.com/simonw/datasette/issues/394#issuecomment-603539349", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/394", "id": 603539349, "node_id": "MDEyOklzc3VlQ29tbWVudDYwMzUzOTM0OQ==", "user": {"value": 132978, "label": "terrycojones"}, "created_at": "2020-03-24T22:33:23Z", "updated_at": "2020-03-24T22:33:23Z", "author_association": "NONE", "body": "Hi Simon - I'm just (trying, at least) to follow along in the above. I can't try it out now, but I will if no one else gets to it. Sorry I didn't write any tests in the original bit of code I pushed - I was just trying to see if it could work & whether you'd want to maybe head in that direction. Anyway, thank you, I will certainly use this. Comment back here if no one tried it out & I'll make time.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 396212021, "label": "base_url configuration setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/394#issuecomment-603525339", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/394", "id": 603525339, "node_id": "MDEyOklzc3VlQ29tbWVudDYwMzUyNTMzOQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-03-24T21:55:46Z", "updated_at": "2020-03-24T22:07:40Z", "author_association": "OWNER", "body": "OK, I have an implementation of this over in the `base-url` branch (see pull request #708) which is passing all of the unit tests.\r\n\r\nAnyone willing to give it a quick test and see if it works for your particular use-case? You can install it with:\r\n\r\n pip install https://github.com/simonw/datasette/archive/base-url.zip\r\n\r\nThen you can run Datasette like this:\r\n\r\n datasette fixtures.db --config base_url:/new-base/path/here/", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 396212021, "label": "base_url configuration setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/394#issuecomment-603509266", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/394", "id": 603509266, "node_id": "MDEyOklzc3VlQ29tbWVudDYwMzUwOTI2Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-03-24T21:16:34Z", "updated_at": "2020-03-24T21:16:34Z", "author_association": "OWNER", "body": "Actually I'll teach `DatasetteRouter` since that subclasses `AsgiRouter` but has access to a `datasette` instance (which it can read configuration values from):\r\nhttps://github.com/simonw/datasette/blob/298a899e792ebd0cd82a5f01b613c31f19082e51/datasette/app.py#L750-L753", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 396212021, "label": "base_url configuration setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/394#issuecomment-603508785", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/394", "id": 603508785, "node_id": "MDEyOklzc3VlQ29tbWVudDYwMzUwODc4NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-03-24T21:15:28Z", "updated_at": "2020-03-24T21:15:28Z", "author_association": "OWNER", "body": "That means I should teach `AsgiRouter` how to handle an optional prefix:\r\nhttps://github.com/simonw/datasette/blob/298a899e792ebd0cd82a5f01b613c31f19082e51/datasette/utils/asgi.py#L81-L93", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 396212021, "label": "base_url configuration setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/394#issuecomment-603508356", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/394", "id": 603508356, "node_id": "MDEyOklzc3VlQ29tbWVudDYwMzUwODM1Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-03-24T21:14:31Z", "updated_at": "2020-03-24T21:14:31Z", "author_association": "OWNER", "body": "I'm going to assume that whatever is proxying to Datasette leaves the full incoming URL path intact, so I'm going to need to teach the URL routing code to strip off the prefix before processing the incoming request.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 396212021, "label": "base_url configuration setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/394#issuecomment-603501719", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/394", "id": 603501719, "node_id": "MDEyOklzc3VlQ29tbWVudDYwMzUwMTcxOQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-03-24T20:59:28Z", "updated_at": "2020-03-24T20:59:28Z", "author_association": "OWNER", "body": "Here's the line I'm stuck on now:\r\n\r\nhttps://github.com/simonw/datasette/blob/298a899e792ebd0cd82a5f01b613c31f19082e51/datasette/views/base.py#L417\r\n\r\nTricky question: do I continue to rebuild URLs based on the incoming `request` (on the assumption that it has been modified to the new thing) or do I expect that I may still see un-prefixed incoming requests and need to change them?\r\n\r\nIf the incoming URL paths contain the prefix, at what point do I drop that so I can run the regular URL matching code?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 396212021, "label": "base_url configuration setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/394#issuecomment-602955699", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/394", "id": 602955699, "node_id": "MDEyOklzc3VlQ29tbWVudDYwMjk1NTY5OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-03-24T01:34:06Z", "updated_at": "2020-03-24T01:34:15Z", "author_association": "OWNER", "body": "I don't think I'll go with the `` solution purely because it doesn't work with JSON APIs - and there are quite a few places where Datasette APIs return URLs (for things like toggling facets - e.g. `suggested_facets` on https://latest.datasette.io/fixtures/facetable.json?_labels=on&_size=0 )\r\n\r\nThe good news is that if you look at the templates almost all of the URLs have been generated in Python code: https://github.com/simonw/datasette/blob/a498d0fe6590f9bdbc4faf9e0dd5faeb3b06002c/datasette/templates/table.html - so it shouldn't be too hard to fix in Python. Ideally I'd like to fix this with as few template changes as possible.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 396212021, "label": "base_url configuration setting"}, "performed_via_github_app": null}