在 Plotly Dash 网站上执行 Basic Auth 示例时,Heroku 崩溃了

Heroku crashed when following Basic Auth example on Plotly Dash website

在 Plotly Dash 网站上关注 Deploying Dash Apps on Heroku example, I then changed app.py to the Basic Auth Example 后。结果我的 Heroku 站点崩溃了。如何使示例在 Heroku 上运行?

查看Heroku日志,发现两个错误:

  1. ModuleNotFoundError: 没有名为 'requests'
  2. 的模块
  3. 无法在 'app' 中找到属性 'server'。

我安装了请求库,确保更新 requirements.txt。 (不确定这一步是否必要,但这是我修复的第一个错误。)在 Basic Auth Example, you will notice server = app.server is not present, but is present in Deploying Dash Apps 中。添加服务器信息后,一切正常:

    app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
    server = app.server