我目前正试图让Sentry参与我的Django项目。在settings.py文件中初始化Sentry时,我遇到以下错误:
第301行,在模块中 导入sentry_sdk ModuleNotFoundError:没有名为“sentry\u sdk”的模块 无法加载应用0(装入点=“”)(找不到可调用或导入错误)
我复制了文件,我想知道为什么会发生这种情况。以前有人遇到过这个问题吗?我的Django版本是2.2.11,运行的是python V3.9.5
以下是文档的代码(pip安装——升级sentry sdk)
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
sentry_sdk.init(
dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
integrations=[DjangoIntegration()],
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production,
traces_sample_rate=1.0,
# If you wish to associate users to errors (assuming you are using
# django.contrib.auth) you may enable sending PII data.
send_default_pii=True,
# By default the SDK will try to use the SENTRY_RELEASE
# environment variable, or infer a git commit
# SHA as release, however you may want to set
# something more human-readable.
# release="myapp@1.0.0",
)
我必须在我的需求文件中包含sentry sdk==1.1.0才能运行它
您确定在您的环境中安装了
sentry
吗? 确保在运行代码的环境中运行pip install sentry-sdk
相关问题 更多 >
编程相关推荐