让我进一步澄清我正在尝试做的事情。我一直在我的机器上开发我的 Django 项目。我还将代码签入存储库。目前我是唯一的开发人员,但其他开发人员将加入。他们将从存储库中签出代码并在他们的机器上运行它。为了模拟这种情况,我将代码检出到另一个目录并创建了一个新数据库。我更新了该结帐的 settings.py 以使用新数据库。当我执行 syncdb 重新创建表时,我收到此错误:
$ python -i manage.py syncdb
DatabaseError: (1146, "Table 'testproj.auth_user' doesn't exist")
Traceback (most recent call last):
File "manage.py", line 13, in <module>
execute_from_command_line(sys.argv)
File "c:\Users\jpp\Documents\.virtualenvs\django-test\lib\site-packages\dja
ngo\core\management\__init__.py", line 453, in execute_from_command_line
utility.execute()
File "c:\Users\jpp\Documents\.virtualenvs\django-test\lib\site-packages\dja
ngo\core\management\__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\Users\jpp\Documents\.virtualenvs\django-test\lib\site-packages\dja
ngo\core\management\base.py", line 230, in run_from_argv
sys.exit(1)
SystemExit: 1
这是我来自 phymyadmin 的数据库设置:
User Host Type Privileges Grant Action
root localhost global ALL PRIVILEGES Yes Edit Privileges
并来自settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'testproj', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'root',
'PASSWORD': '****',
'HOST': '127.0.0.1', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}
这是 INSTALLED_APPS:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'helloworld',
)
因此,我怀疑另一个开发人员也有同样的问题。这是以前必须解决的情况,但我还没有为 Google 拼凑出合适的词。