python - 查找错误 : No installed app with label 'mobile_backend/'

标签 python django google-app-engine google-cloud-datastore app-engine-ndb

我正在将 Django 与应用引擎和数据存储区一起使用。

我想测试应用程序,为此我更改了设置,不为测试创建本地数据库。 在 setting.py 中:

TEST_RUNNER = 'testing.DatabaselessTestRunner'

在测试.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/'.

最佳答案

看起来您的 import 某处有一个偏离的正斜杠 /

确保您在所有相关位置导入 mobile_backend 而不是 mobile_backend/

关于python - 查找错误 : No installed app with label 'mobile_backend/' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29005988/

相关文章:

django - 在这种情况下,主机 header 是否可能中毒?

python - Django select_related 不返回外表数据

python - 在 GAE 项目中包含和引用第 3 方库

python - 内容长度被剥离

python - 如何从 macOS 完全卸载 Anaconda

python - 从数据框中选择特定值

python - Django 通用 View 中 get_context_data 和 queryset 之间的区别?

java - 从 GAE 到 Google+ 的 XMPP 回复不起作用

java - GAE Servlet XML 响应。如何?

python - 当我在图像上打印文本并且它超出了图像的框架时,如何在 OpenCV 中包装文本?