Django 1.4 + Postgres 9.1完整性错误(同步工作正常)

时间:2012-06-01 19:40:51

标签: python postgresql-9.1 psycopg2 django-1.4

我的Django + PostgresSQL 9.1存在问题。当我sybcDB成功创建所有表时,虽然当我尝试在我的应用程序上使用它们时,一切都出错了,我的程序崩溃,但有以下例外:

我在另一台PC上运行与Django 1.3和Postgres 8.4相同的程序,一切正常。

    if self.db.getScheduledEvents(todaysdate):
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 130, in __nonzero__
    iter(self).next()
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 118, in _result_iter
    self._fill_cache()
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 875, in _fill_cache
    self._result_cache.append(self._iter.next())
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 291, in iterator
    for row in compiler.results_iter():
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 763, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 808, in execute_sql
    sql, params = self.as_sql()
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 71, in as_sql
    out_cols = self.get_columns(with_col_aliases)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 218, in get_columns
    col_aliases)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 306, in get_default_columns
    r = '%s.%s' % (qn(alias), qn2(field.column))
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 49, in quote_name_unless_alias
    r = self.connection.ops.quote_name(name)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/dummy/base.py", line 15, in complain
    raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

我的Settings.DATABASES看起来像这样:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'VulntrackingDB',                      # Or path to database file if using sqlite3.
        'USER': 'postgres',                      # Not used with sqlite3.
        'PASSWORD': '********',                  # Not used with sqlite3.
        'HOST': '127.0.0.1',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '5432',                      # Set to empty string for default. Not used with sqlite3.
    }
}

有什么建议吗?我也无法打开我的管理页面。它使用以下内容崩溃了开发服务器:

ramaro@Goncalo-PC:/opt/VulntrackingWebAPP$ python manage.py runserver
Validating models...

0 errors found
Django version 1.4, using settings 'VulntrackingWebAPP.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
    return self.application(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 219, in __call__
    self.load_middleware()
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 51, in load_middleware
    raise exceptions.ImproperlyConfigured('Middleware module "%s" does not define a "%s" class' % (mw_module, mw_classname))
ImproperlyConfigured: Middleware module "django.middleware.csrf" does not define a "CsrfResponseMiddleware" class
[01/Jun/2012 21:35:30] "GET /admin/ HTTP/1.1" 500 59
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
    return self.application(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 219, in __call__
    self.load_middleware()
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 51, in load_middleware
    raise exceptions.ImproperlyConfigured('Middleware module "%s" does not define a "%s" class' % (mw_module, mw_classname))
ImproperlyConfigured: Middleware module "django.middleware.csrf" does not define a "CsrfResponseMiddleware" class

它应该是一些配置缺失但我只是看不到它!可以来自Django 1.4吗?

0 个答案:

没有答案