Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running a dash app below a segment (e.g. http://corporateserver.com/approotisreallythere) #179

Closed
zogzog opened this issue Dec 20, 2017 · 2 comments

Comments

@zogzog
Copy link

zogzog commented Dec 20, 2017

Hi all,

In some setups (corporate env ...) we have no choice but to run a dash app under an application-specific segment. I believe this is currently not supported.

While a specific nginx / wsgi combo is currently used to inform the flask app of this condition, it does not work for dash as the web client routes are configured before the first http request is seen (in dash.__init__).

This hack can be seen there : http://flask.pocoo.org/snippets/35/

Here is the patch I've written to clear the issue on dash side:

diff -r deb1dcee1e55 dash/dash.py
--- a/dash/dash.py      Mon Dec 11 22:56:31 2017 -0600
+++ b/dash/dash.py      Wed Dec 20 12:35:20 2017 +0100
@@ -24,6 +24,7 @@
         server=None,
         static_folder=None,
         url_base_pathname='/',
+        request_pathname_prefix=None,
         **kwargs
     ):

@@ -43,7 +44,7 @@
         self.config = _AttributeDict({
             'suppress_callback_exceptions': False,
             'routes_pathname_prefix': url_base_pathname,
-            'requests_pathname_prefix': url_base_pathname
+            'requests_pathname_prefix': request_pathname_prefix or url_base_pathname
         })

         # list of dependencies

This is quite simple and might be enough. To make it more transparent would probably demand much more work I think.

Opinions ?

@chriddyp
Copy link
Member

Right now, this is done through the config like

app = dash.Dash()
app.config.update({
    'requests_pathname_prefix': ...
})

or

app = dash.Dash()
app.config.requests_pathname_prefix = '...'
})

However, as you mention, this isn't really well documented at all.

I'd prefer a solution that would generically handle all of the config options and maybe enforce a "standard way" of doing this. I see a couple of solutions:
1 - Remove the keyword arguments and move them all to config and document these better
2 - Move all of the config arguments as explicit keyword arguments in dash.Dash(...) and keep them as config

I think 2 seems like a reasonable approach to me, however the call signature might become really huge over time. That might not be a bad thing (for example, I actually like the huge call signature of pd.read_csv)

@zogzog
Copy link
Author

zogzog commented Dec 21, 2017

Ah yes indeed I almost saw this :) Thanks for the clarification.

@chriddyp chriddyp closed this as completed Jun 8, 2018
HammadTheOne pushed a commit to HammadTheOne/dash that referenced this issue May 28, 2021
HammadTheOne pushed a commit to HammadTheOne/dash that referenced this issue May 28, 2021
* - listview styling
- column name nested prop update (support array of strings)
- fix errors in demo app

* bump version, update changelog

* revert demo change
HammadTheOne pushed a commit that referenced this issue Jul 23, 2021
* - listview styling
- column name nested prop update (support array of strings)
- fix errors in demo app

* bump version, update changelog

* revert demo change
HammadTheOne pushed a commit that referenced this issue Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants