Django教程说我还没有设置DATABASE_ENGINE设置...但我有 [英] Django tutorial says I haven't set DATABASE_ENGINE setting yet... but I have

查看:488
本文介绍了Django教程说我还没有设置DATABASE_ENGINE设置...但我有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Django教程,并在运行初始python manage.py syncdb时收到以下错误:

 文件manage.py,第11行在< module> 
execute_manager(settings)
文件/Library/Python/2.6/site-packages/django/core/management/__init__.py,第362行在execute_manager
utility.execute()
文件/Library/Python/2.6/site-packages/django/core/management/__init__.py,第303行,执行
self.fetch_command(子命令).run_from_argv(self.argv)
文件/Library/Python/2.6/site-packages/django/core/management/base.py,第195行,在run_from_argv
self.execute(* args,** options .__ dict__)
文件/Library/Python/2.6/site-packages/django/core/management/base.py,第222行,执行
output = self.handle(* args,** options)
文件/Library/Python/2.6/site-packages/django/core/management/base.py,第351行,处理
return self.handle_noargs(** options)
文件/Library/Python/2.6/site-packages/django/core/management/commands/syncdb.py,第49行,handle_noargs
cursor = connection.cursor()
文件/ Library /的Python / 2.6 /站点包/ Django的/ DB /后端/虚拟/ base.p y,第15行,抱怨
raise不正确配置,你还没有设置DATABASE_ENGINE设置。
django.core.exceptions.ImproperlyConfigured:您尚未设置DATABASE_ENGINE设置。

我的settings.py看起来像:

  DATABASES = {
'default':{
'ENGINE':'django.db.backends.mysql',#添加'postgresql_psycopg2','postgresql' 'mysql','sqlite3'或'oracle'。
'NAME':'dj_tut',#或使用sqlite3的数据库文件路径。
'USER':'',#不与sqlite3一起使用。
'PASSWORD':'',#不与sqlite3一起使用。
'HOST':'',#设置为localhost的空字符串。不适用于sqlite3。
'PORT':'',#设置为空字符串为默认值。不适用于sqlite3。
}
}

我猜这是一个简单的事情,但为什么是不是看到了ENGINE设置?

解决方案

看起来你正在使用较早版本的Django。设置数据库配置的方式来自Django 1.2,但是您所获得的错误是1.1。如果您使用的是版本1.1,请使用此版本的教程


I'm working through the Django tutorial and receiving the following error when I run the initial python manage.py syncdb:

Traceback (most recent call last):
File "manage.py", line 11, in <module>
  execute_manager(settings)
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 362 in execute_manager
  utility.execute()
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 303, in execute
  self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 195, in run_from_argv
  self.execute(*args, **options.__dict__)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 222, in execute
  output = self.handle(*args, **options)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 351, in handle
  return self.handle_noargs(**options)
File "/Library/Python/2.6/site-packages/django/core/management/commands/syncdb.py", line 49, in handle_noargs
  cursor = connection.cursor()
File "/Library/Python/2.6/site-packages/django/db/backends/dummy/base.py", line 15, in complain
  raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE setting yet."
django.core.exceptions.ImproperlyConfigured: You haven't set the DATABASE_ENGINE setting yet.

My settings.py looks like:

DATABASES = {
  'default': {
    'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
    'NAME': 'dj_tut',                      # Or path to database file if using sqlite3.
    'USER': '',                      # 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.
  }
}

I'm guessing this is something simple, but why isn't it seeing the ENGINE setting?

解决方案

It looks like you are using an earlier version of Django. That way of setting database configuration is from Django 1.2, but the error you are getting is from 1.1. If you are using version 1.1, use this version of the tutorial.

这篇关于Django教程说我还没有设置DATABASE_ENGINE设置...但我有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆