0

我想在我的测试服务器上记录我的 Django 应用程序发生的事情,所以我安装了 Django Sentry。

我已经按照官方文档的快速入门指南中的所有内容完成了所有操作,但是当我尝试初始化 Web 服务时,会出现此错误:

sentry.conf.py start
Performing upgrade before service startup...
Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
Migrating...
Running migrations for djcelery:
- Nothing to migrate.
 - Loading initial data for djcelery.
Installed 0 object(s) from 0 fixture(s)
Running migrations for django:
- Nothing to migrate.
 - Loading initial data for django.
Installed 0 object(s) from 0 fixture(s)
Running migrations for django:
- Nothing to migrate.
 - Loading initial data for django.
Installed 0 object(s) from 0 fixture(s)
Running migrations for sentry:
- Nothing to migrate.
 - Loading initial data for sentry.
Installed 0 object(s) from 0 fixture(s)

Synced:
 > django.contrib.auth
 > django.contrib.admin
 > django.contrib.contenttypes
 > django.contrib.sessions
 > django.contrib.sites
 > django.contrib.messages
 > crispy_forms
 > sentry.plugins.sentry_mail
 > sentry.plugins.sentry_servers
 > sentry.plugins.sentry_urls
 > sentry.plugins.sentry_user_emails
 > sentry.plugins.sentry_useragents
 > social_auth
 > south

Migrated:
 - djcelery
 - kombu.transport.django
 - raven.contrib.django
 - sentry
Running service: 'http'
Traceback (most recent call last):
  File "/usr/bin/sentry", line 8, in <module>
    load_entry_point('sentry==5.0.21', 'console_scripts', 'sentry')()
  File "/usr/lib/python2.5/site-packages/sentry/utils/runner.py", line 150, in main
    initializer=initialize_app,
  File "/usr/lib/python2.5/site-packages/logan/runner.py", line 136, in run_app
    management.execute_from_command_line([runner_name, command] + command_args)
  File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.5/site-packages/sentry/management/commands/start.py", line 78, in handle
    service.run()
  File "/usr/lib/python2.5/site-packages/sentry/services/http.py", line 46, in run
    call_command('run_gunicorn', **self.options)
  File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 134, in call_command
    klass = load_command_class(app_name, name)
  File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 69, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/usr/lib/python2.5/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/usr/lib/python2.5/site-packages/gunicorn/management/commands/run_gunicorn.py", line 10, in <module>
    from gunicorn.app.djangoapp import DjangoApplicationCommand
  File "/usr/lib/python2.5/site-packages/gunicorn/app/djangoapp.py", line 9, in <module>
    from gunicorn.app.base import Application
  File "/usr/lib/python2.5/site-packages/gunicorn/app/base.py", line 15, in <module>
    from gunicorn.config import Config
  File "/usr/lib/python2.5/site-packages/gunicorn/config.py", line 241
    except ImportError as e:
                        ^
SyntaxError: invalid syntax

谢谢你的帮助!

4

1 回答 1

1

gunicorn 需要 Python 2.6 - 它添加了except T as e语法(参见http://www.python.org/dev/peps/pep-3110/)。您至少需要切换到 Python 2.6。

请注意,gunicorn 的文档在某些地方说它支持 Python 2.5,但事实并非如此

于 2012-11-12T14:30:25.633 回答