Hey again,
I trued running the script posted on
http://sentry.readthedocs.org/en/latest/faq/index.html#how-do-i (included here again for reference):
---
# Bootstrap the Sentry environment
from sentry.utils.runner import configure
configure()
# Do something crazy
from sentry.models import Team, Project, User
user = User()
user.username = 'admin'
user.email = 'admin@localhost'
user.is_superuser = True
user.set_password('admin')
user.save()
team = Team()
team.name = 'Sentry'
team.owner = user
team.save()
project = Project()
project.team = team
project.owner = user
project.name = 'Default'
project.save()
key = ProjectKey.objects.filter(project=project)[0]
print 'SENTRY_DSN = "%s"' % (key.get_dsn(),)---
However, when I run it I get an error message:
---
# SENTRY_CONF=/etc/sentry/sentry.conf python sentry_init.py
Traceback (most recent call last):
File "/usr/share/nginx/sentry/local/lib/python2.7/site-packages/logan/runner.py", line 101, in settings_callback
'settings': settings,
File "/usr/share/nginx/sentry/local/lib/python2.7/site-packages/sentry/utils/runner.py", line 171, in initialize_app
from
sentry.app import env
File "/usr/share/nginx/sentry/local/lib/python2.7/site-packages/sentry/app.py", line 25, in <module>
buffer = get_instance(settings.BUFFER, settings.BUFFER_OPTIONS)
File "/usr/share/nginx/sentry/local/lib/python2.7/site-packages/sentry/app.py", line 20, in get_instance
cls = import_string(path)
File "/usr/share/nginx/sentry/local/lib/python2.7/site-packages/sentry/utils/imports.py", line 40, in import_string
raise ImportError(path)
ImportError: sentry.buffer.Buffer
---
The problem seems to be this code here (taken from file sentry.utils.imports), where import_string is called with the string argument "'sentry.buffer.Buffer'".
---
class ModuleProxyCache(dict):
def __missing__(self, key):
if not '.' in key:
return __import__(key)
module_name, class_name = key.rsplit('.', 1)
module = __import__(module_name, {}, {}, [class_name], -1)
handler = getattr(module, class_name)
# We cache a NoneType for missing imports to avoid repeated lookups
self[key] = handler
return handler
_cache = ModuleProxyCache()
def import_string(path):
"""
Path must be module.path.ClassName
>>> cls = import_string('sentry.models.Group')
"""
result = _cache[path]
return result
---
On the file system everything seems to be ok:
---
# ls -l ./sentry/lib/python2.7/site-packages/sentry/buffer/
total 28
-rw-r--r-- 1 root root 1976 Jun 15 04:54 base.py
-rw-r--r-- 1 root root 2905 Jun 15 04:56 base.pyc
-rw-r--r-- 1 root root 192 Jun 15 04:54 __init__.py
-rw-r--r-- 1 root root 391 Jun 15 04:56 __init__.pyc
-rw-r--r-- 1 root root 4091 Jun 15 04:54 redis.py
-rw-r--r-- 1 root root 5037 Jun 15 04:56 redis.pyc
# cat ./sentry/lib/python2.7/site-packages/sentry/buffer/__init__.py
"""
sentry.buffer
~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from .base import Buffer # NOQA
---
Futher confusing: The other imports are functioning well (e.g. sentry.utils.runner in sentry_init.py). What am I doing wrong?
Thanks in advance.
Best regards,
Johannes