-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[BUG] Dash 2.1.0 incompatible with Apache wsgi #1928
Comments
I have found a workaround... but it's not ideal. Modify the following file: def __setitem__(self, key, val):
if key in self.__dict__.get("_read_only", {}):
raise AttributeError(self._read_only[key], key)
final_msg = self.__dict__.get("_final")
if final_msg and key not in self:
raise AttributeError(final_msg, key)
return super().__setitem__(key, val) Modified: def __setitem__(self, key, val):
#if key in self.__dict__.get("_read_only", {}):
# raise AttributeError(self._read_only[key], key)
final_msg = self.__dict__.get("_final")
if final_msg and key not in self:
raise AttributeError(final_msg, key)
return super().__setitem__(key, val) other suggestions plotly/jupyter-dash#75 are to do this: del app.config._read_only["requests_pathname_prefix"] however, for me this did not work. |
@pfbuxton are you able to share the full traceback you're seeing? These attributes are read-only for a reason: if they're modified late without being extremely careful about it the app can break in some very confusing ways. Obviously |
Hi @alexcjohnson, Sorry for the delay. I needed to create a virtual OS to do some of the testing. We are using CentOS 7.5. Attached are the relevant files (both settings and errors): To start the Apache example you can do: Here is the error log,
Thanks, |
I see, thanks. Is there a reason this can't all be moved into the constructor though? Also if you're setting app = Dash(__name__, url_base_pathname='/', compress=False)
app.config.update(dict(
routes_pathname_prefix = '/example/',
requests_pathname_prefix = '/example/'
))
app.enable_dev_tools(debug=False)
# Only use local css and javascripts
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True
app.config.suppress_callback_exceptions = True
app.title = 'example' as: app = Dash(
__name__,
url_base_pathname='/example/',
suppress_callback_exceptions=True,
title='example'
) Does that work? |
Hi @alexcjohnson, Your suggestion partially fixed this issue. With my apache settings (i.e. the Anyway the solution is to change the scope in the wsgi file form:
to:
|
In summary I am using Apache as the web-server, but the importing of
app
causes the error:'Read-only: can only be set in the Dash constructor or during init_app()'
This seems to be similar to #1907. All works fine with dash 2.0.0, but breaks with 2.1.0.
Detailed explanation:
Following https://dash.plotly.com/urls we have:
We also have the modwsgi python file,
/var/www/path_to_site/site_name.wsgi
, which Apache is set-up to use, this is what is causing the error:and the Apache settings
/etc/httpd/sites-enabled/site_name.conf
The text was updated successfully, but these errors were encountered: