authentication - Heroku 在 Plotly Dash 网站上遵循 Basic Auth 示例时崩溃
问题描述
在遵循在 Heroku 上部署 Dash 应用程序示例之后,我将 app.py 更改为 Plotly Dash 网站上的基本身份验证示例。结果,我的 Heroku 网站崩溃了。如何使示例在 Heroku 上运行?
解决方案
查看 Heroku 日志,我发现了两个错误:
- ModuleNotFoundError:没有名为“请求”的模块
- 未能在“应用程序”中找到属性“服务器”。
我安装了请求库,确保更新 requirements.txt。(不确定此步骤是否必要,但这是我修复的第一个错误。)在Basic Auth Example中,您会注意到server = app.server
不存在,但存在于Deploying Dash Apps中。添加服务器信息后,一切正常:
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
server = app.server
推荐阅读
- c++ - 指针的常量引用
- java - Junit - 测试套件 - 文件中的类名
- php - 在 Woocommerce 的管理员编辑订单页面上显示每个特定订单的所有可用运输方式
- python - 我如何将相同的数据属性同化到个人 n 次
- reactjs - React + Flask-Socket.io:关闭浏览器时来自客户端的套接字断开事件延迟?
- c - 我需要一个解释:从不兼容的指针类型传递 'sscanf' 的参数 1
- javascript - 在 VS Code 中运行隔离的 JavaScript 命令(不是当前文件)
- android - 在单个活动应用程序中在片段之间进行通信并用新片段替换片段的正确方法
- javascript - 如何用js中的单个字符替换单个数字和两位数字?
- json - 在使用 try/catch 块时捕获“Test-Json”失败的原因