question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom pages don't work with base_url setting

See original GitHub issue

It seems that custom pages aren’t routing properly when the base_url setting is used.

To reproduce, with Datasette 0.55.

Create a templates/pages/custom.html with some text.

mkdir -p templates/pages/
echo "Hello, world!" > templates/pages/custom.html

Start Datasette.

datasette --template-dir templates/

Visit http://localhost:8001/custom and see “Hello, world!”.

Start Datasette with a base_url.

datasette --template-dir templates/ --setting base_url /prefix/

Visit http://localhost:8001/prefix/custom and see a “Database not found: custom” 404.

Note that like all routes, http://localhost:8001/custom still works when run with base_url.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
tsibleycommented, Mar 4, 2021

@rgieseke Ah, that’s super helpful. Thank you for the workaround for now!

0reactions
simonwcommented, Jun 5, 2021

Alternative idea: populate request.scope with a new route_path which is the base-url-stripped version, which we then use for other routing operations.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Github pages ignores Jekyll's baseurl for custom subdomain
Problem is that it doesn't work in production. Github pages completely ignores the baseurl and keeps trying to serve it at sub.domain.com ....
Read more >
site.baseurl behaviour specific to GitHub Pages · Issue #350
The problem is that an empty baseurl is overridden on GitHub Pages, but not a non-empty one. The behaviour is not exactly the...
Read more >
[fastpages] resources of the page won't load when use custom ...
I have created a new repo which give me a page at https://[username].github.io/[repo] it works perfectly. But when I set it up with...
Read more >
docusaurus.config.js
Defaults to the locale's name. Note: this has no effect on the locale's baseUrl —customization of base URL is a work-in-progress. noIndex ...
Read more >
Configuration - Intuit Developer
The SDK allows you to define custom, local app settings in the sdk.config file. ... A base URL defines the work environment accessed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found