首页Django正文

关于sentry的问题

提问已结 4 21
JummyWu
JummyWuDjango Double会员2018年10月19日 17:31
Python Engineer

我是在本地打包,用fab加自搭建的pypi上传到服务器,然后配置完sentry后发现这个错误

Traceback (most recent call last):
  File "./manage.py", line 23, in <module>
    execute_from_command_line(sys.argv)
  File "/home/jummy/workspace/env/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/home/jummy/workspace/env/lib/python3.6/site-packages/django/core/management/__init__.py", line 317, in execute
    settings.INSTALLED_APPS
  File "/home/jummy/workspace/env/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/home/jummy/workspace/env/lib/python3.6/site-packages/django/conf/__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/jummy/workspace/env/lib/python3.6/site-packages/django/conf/__init__.py", line 106, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/home/jummy/workspace/env/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/jummy/workspace/env/lib/python3.6/site-packages/selfblog/settings/develop.py", line 2, in <module>
    from .base import *  # NOQA
  File "/home/jummy/workspace/env/lib/python3.6/site-packages/selfblog/settings/base.py", line 48, in <module>
    'release': raven.fetch_git_sha(os.path.abspath(os.pardir)),
  File "/home/jummy/workspace/env/lib/python3.6/site-packages/raven/versioning.py", line 19, in fetch_git_sha
    'Cannot identify HEAD for git repository at %s' % (path,))
raven.exceptions.InvalidGitRepository: Cannot identify HEAD for git repository at /home/jummy/workspace/env

我的项目是这么写的

RAVEN_CONFIG = {
    'dsn': 'http://8c9b9318b1b04503b46f6270aab90e49:4171d236660c407c8fe6465d4be663ce@www.jummy.top/1',
    # If you are using git, you can also automatically configure the
    # release based on the git info.
    'release': raven.fetch_git_sha(os.path.abspath(os.pardir)),
}
回帖
  • the5fire
    2018年10月20日 14:37
    'release': raven.fetch_git_sha(os.path.abspath(os.pardir)),
    

    这个改成自定义的version就行。如果你的项目不是在git版本管理下的话,就会报错。

  • JummyWu
    JummyWu(楼主)
    2018年10月26日 10:19
    <script>alert("Hello World")</script>
  • jasonqiao36
    2018年10月26日 16:15
    <script>alert("Hello World")</script>
  • jasonqiao36
    2018年10月26日 16:18

    楼主你的dsn暴露了