gpt4 book ai didi

mysql - Django 教程说我还没有设置 DATABASE_ENGINE 设置......但我有

转载 作者:可可西里 更新时间:2023-11-01 06:58:13 36 4
gpt4 key购买 nike

我正在学习 Django 教程并在运行初始 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.

我的 settings.py 看起来像:

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.
}
}

我猜这很简单,但为什么它没有看到 ENGINE 设置?

最佳答案

看起来您使用的是较早版本的 Django。这种设置数据库配置的方法来自 Django 1.2,但您得到的错误来自 1.1。如果您使用的是 1.1 版,请使用 this version of the tutorial .

关于mysql - Django 教程说我还没有设置 DATABASE_ENGINE 设置......但我有,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2947618/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com