我目前正在研究django应用程序上的简单逻辑。
但是当我执行测试用例时,会抛出操作错误。所以我删除了所有测试用例并运行了manage.py测试,但我仍然遇到操作错误。
有人可以告诉我在运行django测试时我缺少什么吗?
我得到的错误如下:
Creating test database for alias 'default'...
Traceback (most recent call last):
File "D:\Users\sankar\workspace\alaTest_ProgrammingTest\src\manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\core\management\__init__.py", line 330, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\core\management\__init__.py", line 322, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\core\management\commands\test.py", line 30, in run_from_argv
super(Command, self).run_from_argv(argv)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\core\management\base.py", line 363, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\core\management\commands\test.py", line 74, in execute
super(Command, self).execute(*args, **options)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\core\management\base.py", line 413, in execute
output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\core\management\commands\test.py", line 90, in handle
failures = test_runner.run_tests(test_labels)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\test\runner.py", line 151, in run_tests
old_config = self.setup_databases()
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\test\runner.py", line 113, in setup_databases
return setup_databases(self.verbosity, self.interactive, self.keepdb, **kwargs)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\test\runner.py", line 304, in setup_databases
serialize=connection.settings_dict.get("TEST_SERIALIZE", True),
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\db\backends\creation.py", line 391, in create_test_db
self.connection._test_serialized_contents = self.serialize_db_to_string()
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\db\backends\creation.py", line 433, in serialize_db_to_string
serializers.serialize("json", get_objects(), indent=None, stream=out)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\core\serializers\__init__.py", line 128, in serialize
s.serialize(queryset, **options)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\core\serializers\base.py", line 52, in serialize
for obj in queryset:
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\db\backends\creation.py", line 429, in get_objects
for obj in queryset.iterator():
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\db\models\query.py", line 287, in iterator
for row in compiler.results_iter():
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\db\models\sql\compiler.py", line 699, in results_iter
for rows in self.execute_sql(MULTI):
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\db\models\sql\compiler.py", line 785, in execute_sql
cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\db\backends\utils.py", line 63, in execute
return self.cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\db\utils.py", line 95, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\db\backends\utils.py", line 63, in execute
return self.cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django-1.8-py2.7.egg\django\db\backends\sqlite3\base.py", line 489, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: Operators_operator_details
Finished "D:\Users\sankar\workspace\alaTest_ProgrammingTest\src\manage.py test" execution.
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#added the Operators application to the project
'Operators',
)
我在设置文件中安装的应用程序如下: