相关疑难解决方法(0)

使用django 1.4执行syncdb时出现"settings.DATABASES配置不正确"错误

我创建了一个简单的django 1.4项目,并尝试发出syncdb来创建(postgres)数据库模式.我收到这个错误: -

Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 371, in handle
return self.handle_noargs(**options)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs
cursor = connection.cursor()
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/dummy/base.py", line 15, in complain
raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly …
Run Code Online (Sandbox Code Playgroud)

django django-models django-admin

36
推荐指数
3
解决办法
6万
查看次数

请提供ENGINE值Django数据库配置

伙计们我很困惑我已经安装了Django,并运行服务器ok,但是当尝试配置数据库时运行db sync命令它崩溃返回我的ENGINE参数不正常,但设置文件没问题.按照设置文件:

    DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'mysite',                      # Or path to database file if using sqlite3.
        'USER': 'root',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}
Run Code Online (Sandbox Code Playgroud)

而错误:

 Traceback (most recent call last):
  File "manage.py", line 10, …
Run Code Online (Sandbox Code Playgroud)

python database django settings

6
推荐指数
1
解决办法
7714
查看次数