配置不正确:您需要在Django设置文件中指定NAME

时间:2011-01-05 17:56:56

标签: python django

我快到了!在我的mac OSX中部署EveryBlock的ebcode - 这是我的settings.py:

http://pastebin.com/ndQ57LCH

这是整个错误:

  Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/django/core/servers/basehttp.py", line 280, in run
    self.result = application(self.environ, self.start_response)
  File "/Library/Python/2.6/site-packages/django/core/servers/basehttp.py", line 674, in __call__
    return self.application(environ, start_response)
  File "/Library/Python/2.6/site-packages/django/core/handlers/wsgi.py", line 234, in __call__
    signals.request_started.send(sender=self.__class__)
  File "/Library/Python/2.6/site-packages/django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Library/Python/2.6/site-packages/django/db/__init__.py", line 90, in reset_queries
    for conn in connections.all():
  File "/Library/Python/2.6/site-packages/django/db/utils.py", line 101, in all
    return [self[alias] for alias in self]
  File "/Library/Python/2.6/site-packages/django/db/utils.py", line 93, in __getitem__
    conn = backend.DatabaseWrapper(db, alias)
  File "/Library/Python/2.6/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 11, in __init__
    self.ops = PostGISOperations(self)
  File "/Library/Python/2.6/site-packages/django/contrib/gis/db/backends/postgis/operations.py", line 91, in __init__
    vtup = self.postgis_version_tuple()
  File "/Library/Python/2.6/site-packages/django/contrib/gis/db/backends/postgis/operations.py", line 445, in postgis_version_tuple
    version = self.postgis_lib_version()
  File "/Library/Python/2.6/site-packages/django/contrib/gis/db/backends/postgis/operations.py", line 425, in postgis_lib_version
    return self._get_postgis_func('postgis_lib_version')
  File "/Library/Python/2.6/site-packages/django/contrib/gis/db/backends/postgis/operations.py", line 406, in _get_postgis_func
    cursor = self.connection._cursor()
  File "/Library/Python/2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 121, in _cursor
    raise ImproperlyConfigured("You need to specify NAME in your Django settings file.")
ImproperlyConfigured: You need to specify NAME in your Django settings file.

请告知。

2 个答案:

答案 0 :(得分:5)

  1. 使用 单数据库设置(DATABASE_xxx = ...多数据库(DATABASES dict)设置
  2. 不要将“DATABASE_”添加到词典键,例如在DATABASES["users"])。这就是错误的来源。
  3. 不要在SO
  4. 上共享您的数据库密码

答案 1 :(得分:1)

我想您可能忘记在NAME设置中设置DATABASES属性:

DATABASES setting