我是在一个酒瓶应用程序中提供破折号内容,它使用蓝图注册路线。应用程序设置:
route_pathname_prefix=/dashapp/初始化破折号dash_app = dash.Dash(
server=server,
routes_pathname_prefix='/dashapp/',
)
dash_app.css.config.serve_locally = True
dash_app.scripts.config.serve_locally = True[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配置
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的代码。
这太让人费解了!
发布于 2021-06-15 10:22:54
我能够通过从nginx中删除sub_filter指令并在烧瓶应用程序中更新url_prefixes来修复这个问题。我采取的步骤被发布在这 dash论坛上。
https://stackoverflow.com/questions/67947053
复制相似问题