{"html_url": "https://github.com/simonw/datasette/issues/1238#issuecomment-790857004", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1238", "id": 790857004, "node_id": "MDEyOklzc3VlQ29tbWVudDc5MDg1NzAwNA==", "user": {"value": 79913, "label": "tsibley"}, "created_at": "2021-03-04T19:06:55Z", "updated_at": "2021-03-04T19:06:55Z", "author_association": "NONE", "body": "@rgieseke Ah, that's super helpful. Thank you for the workaround for now!", "reactions": "{\"total_count\": 1, \"+1\": 1, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 813899472, "label": "Custom pages don't work with base_url setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1238#issuecomment-789186458", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1238", "id": 789186458, "node_id": "MDEyOklzc3VlQ29tbWVudDc4OTE4NjQ1OA==", "user": {"value": 198537, "label": "rgieseke"}, "created_at": "2021-03-02T20:19:30Z", "updated_at": "2021-03-02T20:19:30Z", "author_association": "CONTRIBUTOR", "body": "A custom `templates/index.html` seems to work and custom `pages` as a workaround with moving them to `pages/base_url_dir`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 813899472, "label": "Custom pages don't work with base_url setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1238#issuecomment-786849095", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1238", "id": 786849095, "node_id": "MDEyOklzc3VlQ29tbWVudDc4Njg0OTA5NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-02-26T19:29:38Z", "updated_at": "2021-02-26T19:29:38Z", "author_association": "OWNER", "body": "Here's the test I wrote:\r\n```diff\r\ngit diff tests/test_custom_pages.py\r\ndiff --git a/tests/test_custom_pages.py b/tests/test_custom_pages.py\r\nindex 6a23192..5a71f56 100644\r\n--- a/tests/test_custom_pages.py\r\n+++ b/tests/test_custom_pages.py\r\n@@ -2,11 +2,19 @@ import pathlib\r\n import pytest\r\n from .fixtures import make_app_client\r\n \r\n+TEST_TEMPLATE_DIRS = str(pathlib.Path(__file__).parent / \"test_templates\")\r\n+\r\n \r\n @pytest.fixture(scope=\"session\")\r\n def custom_pages_client():\r\n+ with make_app_client(template_dir=TEST_TEMPLATE_DIRS) as client:\r\n+ yield client\r\n+\r\n+\r\n+@pytest.fixture(scope=\"session\")\r\n+def custom_pages_client_with_base_url():\r\n with make_app_client(\r\n- template_dir=str(pathlib.Path(__file__).parent / \"test_templates\")\r\n+ template_dir=TEST_TEMPLATE_DIRS, config={\"base_url\": \"/prefix/\"}\r\n ) as client:\r\n yield client\r\n \r\n@@ -23,6 +31,12 @@ def test_request_is_available(custom_pages_client):\r\n assert \"path:/request\" == response.text\r\n \r\n \r\n+def test_custom_pages_with_base_url(custom_pages_client_with_base_url):\r\n+ response = custom_pages_client_with_base_url.get(\"/prefix/request\")\r\n+ assert 200 == response.status\r\n+ assert \"path:/prefix/request\" == response.text\r\n+\r\n+\r\n def test_custom_pages_nested(custom_pages_client):\r\n response = custom_pages_client.get(\"/nested/nest\")\r\n assert 200 == response.status\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 813899472, "label": "Custom pages don't work with base_url setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1238#issuecomment-786848654", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1238", "id": 786848654, "node_id": "MDEyOklzc3VlQ29tbWVudDc4Njg0ODY1NA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-02-26T19:28:48Z", "updated_at": "2021-02-26T19:28:48Z", "author_association": "OWNER", "body": "I added a debug line just before `for regex, wildcard_template` here:\r\n\r\nhttps://github.com/simonw/datasette/blob/afed51b1e36cf275c39e71c7cb262d6c5bdbaa31/datasette/app.py#L1148-L1155\r\n\r\nAnd it showed that for some reason `request.path` is `/prefix/prefix/request` here - the prefix got doubled somehow.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 813899472, "label": "Custom pages don't work with base_url setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1238#issuecomment-786841261", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1238", "id": 786841261, "node_id": "MDEyOklzc3VlQ29tbWVudDc4Njg0MTI2MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-02-26T19:13:44Z", "updated_at": "2021-02-26T19:13:44Z", "author_association": "OWNER", "body": "Sounds like a bug - thanks for reporting this.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 813899472, "label": "Custom pages don't work with base_url setting"}, "performed_via_github_app": null}