首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法从Nginx后面运行的dash应用程序加载dash布局和_dash依赖项

无法从Nginx后面运行的dash应用程序加载dash布局和_dash依赖项
EN

Stack Overflow用户
提问于 2021-06-12 08:32:34
回答 1查看 421关注 0票数 0

我是在一个酒瓶应用程序中提供破折号内容,它使用蓝图注册路线。应用程序设置:

  1. route_pathname_prefix=/dashapp/初始化破折号
代码语言:javascript
复制
dash_app = dash.Dash(
        server=server,
        routes_pathname_prefix='/dashapp/',
    )

dash_app.css.config.serve_locally = True
dash_app.scripts.config.serve_locally = True
  1. 用Flask服务器注册的dash应用程序
  2. 使用UWSGI在码头容器内提供水瓶应用程序
代码语言:javascript
复制
[uwsgi]
wsgi-file = </path/to/app.py>
callable = app
http = 0.0.0.0:8080
processes = 4
threads = 2
master = true
chmod-socket = 660
vacuum = true
die-on-term = true

到目前为止,当地一切都很好。一旦我添加了Nginx代理,我就得到了以下问题

问题:_dash-layout_dash-dependencies的uri缺少revers uri。例如,我在www.example.com/app/为我的烧瓶应用提供服务。但是,在浏览器上,我看到对_dash-layout_dash-dependencies的请求是在www.example.com/dashpp/_dash-layout而不是www.example.com/app/dashpp/_dash-layout上发出的。

我阅读了下面的论坛讨论并尝试应用该解决方案,并得到了这个错误,requests_pathname_prefix需要从‘/’开始

这是我的Nginx配置

代码语言:javascript
复制
location /app/ {
    proxy_pass http://localhost:<port>;
    proxy_redirect http://localhost:<port> http://example.com/app/;
    proxy_set_header Accept Encoding "";
    sub_filter_types *;
    sub_filter 'href="/' 'href="/app/';
    sub_filter 'src="/' 'src="/app/';
    sub_filter_once off;
}

任何人都有关于缺少什么的指示。我是新来的。因此,如果我错过了添加任何信息,请告诉我,我很乐意提供更多的细节。

谢谢

PS:我在dash 论坛中添加了同样的问题。把它张贴在这里,以便更好地到达。

编辑:

为了添加额外的上下文,我发现_dash-component-suites的url是按照预期的www.example.com/app/dashpp/_dash-component-suites生成的。我仔细研究了破折号源代码,以了解urls是如何生成的。_dash-component-suites_dash-layout都以routes_pathname_prefix作为前缀。版本1.14.0中的dash.py的第428至448行有构建urls的代码。

这太让人费解了!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-06-15 10:22:54

我能够通过从nginx中删除sub_filter指令并在烧瓶应用程序中更新url_prefixes来修复这个问题。我采取的步骤被发布在 dash论坛上。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67947053

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档