我正在将django与app引擎和数据存储区一起使用。
我想测试应用程序,因为我已经更改了我的设置而没有为测试创建本地数据库。 在setting.py中:
TEST_RUNNER = 'testing.DatabaselessTestRunner'
在testing.py
中 """Support for testing."""
from django.test.simple import DjangoTestSuiteRunner
class DatabaselessTestRunner(DjangoTestSuiteRunner):
"""A test suite runner that does not set up and tear down a database."""
def setup_databases(self):
"""Overrides DjangoTestSuiteRunner"""
pass
def teardown_databases(self, *args):
"""Overrides DjangoTestSuiteRunner"""
pass
当我运行时:python manage.py test mobile_backend /
我有一个奇怪的错误:
raise LookupError("No installed app with label '%s'." % app_label)
LookupError: No installed app with label 'mobile_backend/'.
但在我的setting.py中,我已将“'mobile_backend'”添加到我的INSTALLED_APPS
有人可以帮助我吗?
由于
修改
我的错误的完整堆栈跟踪:
/usr/local/lib/python2.7/dist-packages/django/test/_doctest.py:59: RemovedInDjango18Warning: The django.test._doctest module is deprecated; use the doctest module from the Python standard library instead. RemovedInDjango18Warning)
/usr/local/lib/python2.7/dist-packages/django/test/simple.py:27: RemovedInDjango18Warning: The django.test.simple module and DjangoTestSuiteRunner are deprecated; use django.test.runner.DiscoverRunner instead. RemovedInDjango18Warning)
Traceback (most recent call last): File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/test.py", line 50, in run_from_argv
super(Command, self).run_from_argv(argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__) File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/test.py", line 71, in execute
super(Command, self).execute(*args, **options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/test.py", line 88, in handle
failures = test_runner.run_tests(test_labels) File "/usr/local/lib/python2.7/dist-packages/django/test/runner.py", line 146, in run_tests
suite = self.build_suite(test_labels, extra_tests) File "/usr/local/lib/python2.7/dist-packages/django/test/simple.py", line 241, in build_suite
app_config = apps.get_app_config(label) File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 150, in get_app_config
raise LookupError("No installed app with label '%s'." % app_label) LookupError: No installed app with label 'mobile_backend/'.
答案 0 :(得分:1)
您的/
某处似乎有一个向前斜线import
。
确保您在所有相关位置导入mobile_backend
而不是mobile_backend/
。