我正试图在Heroku中向我的python烧瓶应用程序添加rollbar。
文件
Rollbar = "~=0.14.7"app.py
import rollbar
rollbar_api_key = os.environ['ROLLBAR_API_KEY']
rollbar.init(rollbar_api_key)
rollbar.report_message('Rollbar is configured correctly')
try:
b = a + 1
except:
rollbar.report_exc_info()但这不管用。
我不能在Heroku中添加滚动条作为一个注释,因为信用卡细节是必需的。可以在heroku中添加没有附加项的滚动条吗?
更新:
错误:
app[web.1]: import rollbar
app[web.1]: ModuleNotFoundError: No module named 'rollbar'链接到我试图为其添加Rollbar的应用程序
发布于 2019-12-18 05:38:39
由于您正在看到错误ModuleNotFound,所以似乎没有安装rollbar python包。
要将新包添加到项目的Pipfile和Pipfile.lock中,必须使用pipenv包:
$ pip install pipenv
[...]
$ pipenv install rollbar
Creating a Pipfile for this project…
Installing rollbar…
Adding rollbar to Pipfile's [packages]…
✔ Installation Succeeded
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
✔ Success!
Updated Pipfile.lock (0834c3)!
With pipenv you'll need the `pipenv install` command:
, following for example the [pipenv guide here](https://realpython.com/pipenv-guide/#example-usage). 正如您在输出中看到的,该命令将同时更新Pipfile和Pipfile.lock。
发布于 2019-12-13 13:26:01
您设置了ROLLBAR_API_KEY环境变量的值吗?当您添加Rollbar插件时,它会为您设置这个值,但是如果您想使用Roller而不使用外接程序,则需要自己设置它。这可以用heroku config:set ROLLBAR_API_KEY=ABC123来完成。
https://stackoverflow.com/questions/59316991
复制相似问题