I am trying to add rollbar to my python flask application in Heroku.
Pipfile
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()
But this is not working.
I am not able to add rollbar as an addon in Heroku since credit card details are required. Is it possible to add rollbar in heroku without the add-on?
Update:
Error:
app[web.1]: import rollbar
app[web.1]: ModuleNotFoundError: No module named 'rollbar'
Link to the app for which I am trying to add Rollbar
:
Since you are seeing the error
ModuleNotFound
, it seems like therollbar
python package is not installed.To add a new package to the project's
Pipfile
andPipfile.lock
you have to use thepipenv
package:As you see in the output the command will update both
Pipfile
andPipfile.lock
.