oq-engine
oq-engine copied to clipboard
Serve openquake on a different context path
Hi, is there a way to serve openquake on a different context path?
For example for a custom path mypath
we'd like to have:
-
http://localhost:8800/mypath/accounts/login/
instead ofhttp://localhost:8800/accounts/login/
-
http://localhost:8800/mypath/engine
instead ofhttp://localhost:8800/engine
-
http://localhost:8800/mypath/v1/engine_version
instead ofhttp://localhost:8800/v1/engine_version
You have to change the django routes, see https://github.com/gem/oq-engine/blob/master/openquake/server/urls.py
Thanks for your reply, but it would be great if we have the option as a parameter so we won't compile the code each time
I'd suggest adding a CONTEXT
parameter and use it like below
Example for docker: docker run -d --name openquake -p 80:8800 -e CONTEXT=/openquake openquake/engine:latest
We accept pull requests.
Sorry i'm not a Python developer :)
I tried with FORCE_SCRIPT_NAME = "/openquake"
in settings.py
but it doesn't seem to work
I would like to implement the feature in one place without touching all the url paths in urls.py
Something like what I'm used to do in Node.js
, please see this nodejs sample app
- app routes (urls) definition: https://github.com/adnanesaghir/expressjs-app/blob/master/routes.js
- setting secondary custom app path from an environment variable in one line without touching default routes: https://github.com/adnanesaghir/expressjs-app/blob/49f73bfcaaf663d065c217bb5c659f9d736ef50b/app.js#L8
This is implemented in current master as documented here: https://github.com/gem/oq-engine/blob/master/docker/README.md (see the section on WEBUI_PATHPREFIX).