Open larsimmisch opened 8 years ago
(fixed typos in original report)
It looks like the problem might be to do with the order the config defaults are generated. https://github.com/scragg0x/realms-wiki/blob/master/realms/config/__init__.py#L180-L186
RELATIVE_PATH is generated based on BASE_URL before the user's custom BASE_URL is set. I bet if you manually specify your RELATIVE_PATH it would work.
I think the proper fix is re-considering the order in which certain defaults get set in the config package. I think any defaults based on other config values needs to happen after the user config import, then it needs to check that the user didn't set them explicitly before overriding with the generated default.
Thanks @gazpachoking,
good catch! Unfortunately this is no fix, but that is a different matter.
The relevant fragment from my realms-wiki.json
looks like this:
{
"ALLOW_ANON": false,
"PRIVATE_WIKI": true,
"BASE_URL": "https://example.org",
"RELATIVE_PATH": "/wiki",
...
}
With this I surprisingly get redirected to https://example.org/wiki/wiki
. If I reorder https://github.com/scragg0x/realms-wiki/blob/master/realms/config/__init__.py, the same thing happens (obviously).
I agree RELATIVE_PATH
should be evaluated after https://github.com/scragg0x/realms-wiki/blob/master/realms/config/__init__.py#L199.
Ah. I should mention that I have these problems when I run realms-wiki as a wsgi script. My relevant apache configuration is:
WSGIDaemonProcess realms_wsgi user=www-data group=www-data \
home=/usr/local/src/realms-wiki display-name=%{GROUP}
WSGIProcessGroup realms_wsgi
WSGIScriptAlias /wiki /Library/SSL/wiki/wsgi.py
Alias /wiki/static /usr/local/src/realms-wiki/realms/static
<Directory /Library/SSL/wiki>
Options -Indexes
Require all granted
</Directory>
My realms instance has a relative base URL - something like
https://example.org/wiki
In this setup, I cannot save pages, because I get redirected to
https://example.org/foo
(iffoo
is the page name) and nothttps://example.org/wiki/foo
.I tried looking into the issue, but only have found one clue so far. The page source for the edit page has this snippet:
That's puzzling. I'd expect
Config.RELATIVE_PATH
to bewiki
, not the empty string. TheBASE_URL
in my (only)realms-wiki.json
ishttps://example.org/wiki
.(I hope this is not a red herring)