2011-12-22 5 views
2

Django-sentry가 나를 사랑하지 않습니다. localhost : 9000/store에 오류를 보내려고합니다. Django-Sentry는 localhost : 9000/store에 오류를 보내려고 할 때 오류 405를 표시합니다.


그리고 코드의 다른 부분에

SENTRY_SERVERS = ['http://0.0.0.0:9000/store'] 
SENTRY_KEY = "666" 

TEMPLATE_DEBUG = True 
SENTRY_TESTING = True 

LOGGING = { 
    'version': 1, 
    'disable_existing_loggers': True, 
    'formatters': { 
     'default': { 
      'format': '%(asctime)s [%(levelname)s] M:%(name)s, P:%(process)d, F:%(filename)s:%(lineno)d, MSG:%(message)s', 
      'datefmt': '%a, %d %b %Y %H:%M:%S %z', 
     }, 
    }, 
    'root': { 
      'level':'DEBUG',   # CHANGE TO DEFAULT_LEVEL 
      'handlers':['sentry', 'console'], 
    }, 
    'handlers': { 
     'sentry': { 
      'level':'INFO', 
      'class': 'raven.contrib.django.handlers.SentryHandler', 
      'formatter':'default' 
     }, 
     'console':{ 
      'level':'INFO', 
      'class':'logging.StreamHandler', 
      'formatter': 'default' 
     }, 
    }, 
    'loggers': { 
     'sentry.errors': { 
      'level': 'DEBUG', 
      'handlers': ['console'], 
      'propagate': False, 
     }, 
    } 
} 
나는 수동으로 오류가 발생 다음과 같이 내가 settings.py에서 일부 센트리 설정을 설정 한

jamis$ python manage.py runserver 
Validating models... 

0 errors found 
Django version 1.3.1, using settings 'hv.settings' 
Development server is running at http://127.0.0.1:8000/ 
Quit the server with CONTROL-C. 

// useless info left out 

Thu, 22 Dec 2011 18:45:13 +0000 [ERROR] M:sentry.errors.client, P:9067, F:base.py:226, MSG:Unable to reach Sentry log server: HTTP Error 405: METHOD NOT ALLOWED (url: http://0.0.0.0:9000/store, body:) 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/raven/base.py", line 222, in send 
    return self.send_remote(url=url, data=message, headers=headers) 
    File "/Library/Python/2.7/site-packages/raven/base.py", line 201, in send_remote 
    response = urllib2.urlopen(req, data).read() 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen 
    return _opener.open(url, data, timeout) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open 
    response = meth(req, response) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response 
    'http', request, response, code, msg, hdrs) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 432, in error 
    result = self._call_chain(*args) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain 
    result = func(*args) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 619, in http_error_302 
    return self.parent.open(new, timeout=req.timeout) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open 
    response = meth(req, response) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response 
    'http', request, response, code, msg, hdrs) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 438, in error 
    return self._call_chain(*args) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain 
    result = func(*args) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 521, in http_error_default 
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) 
HTTPError: HTTP Error 405: METHOD NOT ALLOWED 
Thu, 22 Dec 2011 18:45:13 +0000 [WARNING] M:sentry.errors.client, P:9067, F:base.py:227, MSG:Not Found: /favicon.ico 
Thu, 22 Dec 2011 18:45:13 +0000 [WARNING] M:django.request, P:9067, F:base.py:142, MSG:Not Found: /favicon.ico 
[22/Dec/2011 18:45:14] "POST /accounts/login/ HTTP/1.1" 302 0 
Thu, 22 Dec 2011 18:45:15 +0000 [ERROR] M:sentry.errors.client, P:9067, F:base.py:226, MSG:Unable to reach Sentry log server: HTTP Error 405: METHOD NOT ALLOWED (url: http://0.0.0.0:9000/store, body:) 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/raven/base.py", line 222, in send 
    return self.send_remote(url=url, data=message, headers=headers) 
    File "/Library/Python/2.7/site-packages/raven/base.py", line 201, in send_remote 
    response = urllib2.urlopen(req, data).read() 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen 
    return _opener.open(url, data, timeout) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open 
    response = meth(req, response) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response 
    'http', request, response, code, msg, hdrs) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 432, in error 
    result = self._call_chain(*args) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain 
    result = func(*args) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 619, in http_error_302 
    return self.parent.open(new, timeout=req.timeout) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open 
    response = meth(req, response) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response 
    'http', request, response, code, msg, hdrs) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 438, in error 
    return self._call_chain(*args) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain 
    result = func(*args) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 521, in http_error_default 
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) 
HTTPError: HTTP Error 405: METHOD NOT ALLOWED 
Thu, 22 Dec 2011 18:45:15 +0000 [CRITICAL] M:sentry.errors.client, P:9067, F:base.py:227, MSG: 
Thu, 22 Dec 2011 18:45:15 +0000 [CRITICAL] M:root, P:9067, F:home.py:17, MSG: 
[22/Dec/2011 18:45:15] "GET/HTTP/1.1" 200 8903 
[22/Dec/2011 18:45:15] "GET /static/css/build/bootstrap/bootstrap.css HTTP/1.1" 304 0 
[22/Dec/2011 18:45:15] "GET /static/css/build/hv-pages.css HTTP/1.1" 200 2019 
[22/Dec/2011 18:45:15] "GET /static/css/build/pages/hv-notifications-dialogs.css HTTP/1.1" 200 373 
Thu, 22 Dec 2011 18:45:15 +0000 [ERROR] M:sentry.errors.client, P:9067, F:base.py:226, MSG:Unable to reach Sentry log server: HTTP Error 405: METHOD NOT ALLOWED (url: http://0.0.0.0:9000/store, body:) 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/raven/base.py", line 222, in send 
    return self.send_remote(url=url, data=message, headers=headers) 
    File "/Library/Python/2.7/site-packages/raven/base.py", line 201, in send_remote 
    response = urllib2.urlopen(req, data).read() 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen 
    return _opener.open(url, data, timeout) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open 
    response = meth(req, response) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response 
    'http', request, response, code, msg, hdrs) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 432, in error 
    result = self._call_chain(*args) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain 
    result = func(*args) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 619, in http_error_302 
    return self.parent.open(new, timeout=req.timeout) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open 
    response = meth(req, response) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response 
    'http', request, response, code, msg, hdrs) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 438, in error 
    return self._call_chain(*args) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain 
    result = func(*args) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 521, in http_error_default 
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) 
HTTPError: HTTP Error 405: METHOD NOT ALLOWED 
Thu, 22 Dec 2011 18:45:15 +0000 [WARNING] M:sentry.errors.client, P:9067, F:base.py:227, MSG:Not Found: /favicon.ico 
Thu, 22 Dec 2011 18:45:15 +0000 [WARNING] M:django.request, P:9067, F:base.py:142, MSG:Not Found: /favicon.ico 

다음은 오류입니다

logger = logging.getLogger() 
logger.critical() 

또한 센트리와 r 나는 '

import os.path 

from sentry.conf.server import * 

ROOT = os.path.dirname(__file__) 

DATABASES = { 
    'default': { 
     # You can swap out the engine for MySQL easily by changing this value 
     # to ``django.db.backends.mysql`` or to PostgreSQL with 
     # ``django.db.backends.postgresql_psycopg2`` 
     'ENGINE': 'django.db.backends.sqlite3', 
     'NAME': os.path.join(ROOT, 'sentry.db'), 
     'USER': 'postgres', 
     'PASSWORD': '', 
     'HOST': '', 
     'PORT': '', 
    } 
} 

SENTRY_KEY = "666" 

# Set this to false to require authentication 
SENTRY_PUBLIC = True 

SENTRY_WEB_HOST = '0.0.0.0' 
SENTRY_WEB_PORT = 9000 

SENTRY_WEB_LOG_FILE = os.path.join(ROOT, 'sentry.log') 
SENTRY_WEB_PID_FILE = os.path.join(ROOT, 'sentry.pid') 

: 내 INSTALLED_APPS 여기


에서 aven.contrib.django은 (~/.sentry/sentry.conf.py에 위치) 센트리의 기본 설정 파일입니다 Sentry 서버에 잘못 액세스하고 있지만 확실하지 않습니다. 까마귀와 장고 보초에 대한 문서는 매우 간결합니다! 어떤 도움이라도 대단히 감사하겠습니다.

답변

4

나는 몇 시간과 몇 시간 후에 그것을 알아 냈다! 이 문제가 발생하는 경우 해결책이 될 수 있습니다.

SENTRY_SERVERS = ['http://0.0.0.0:9000/store'] 

에는 슬래시가 있어야합니다.

SENTRY_SERVERS = ['http://0.0.0.0:9000/store/'] 

게일.

+0

django-sentry에게 버그로 신고하고 싶을 수도 있습니다. –

+0

어디로 갈까요? 클라이언트 연결을위한 JS 파일, 또는 파이썬 구성 파일 어딘가에? – NoBugs

0

같은 원인으로 약간의 simular 문제가 있습니다. 여기에 게시하십시오.

이것은 보초에 대한 생성 된 구성 파일의 모양입니다. 나는 그러나 sentry test 으로 테스트 할 때

# You should configure the absolute URI to Sentry. It will attempt to guess it if 
# you don't but proxies may interfere with this. 
SENTRY_URL_PREFIX = 'http://localhost:9001' # No trailing slash! 
SENTRY_WEB_HOST = '0.0.0.0' 
SENTRY_WEB_PORT = 9001` 

그것은 작업 로그에 연결하면, 나는 이 지침 inspite 끝에 슬래시를 추가 할 때 이러한 오류가 사라 몇 가지 오류

ERROR Unable to reach Sentry log server: <urlopen error timed out> 
(url:http://localhost:9001/api/store/) 
.......... 
.......... 
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", 
line 1174, in do_open raise URLError(err)..... 
URLError: <urlopen error timed out> 

을 얻었다. 어쩌면 내 지역 설정이나 무언가와 관련이있을 수 있습니다.