Django ImportError: ImportError: No module named 'sheets'

Django ImportError: ImportError: No module named 'sheets'

我的应用程序中出现了这个错误:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 327, in execute
    django.setup()
  File "/usr/local/lib/python3.5/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.5/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/usr/local/lib/python3.5/site-packages/django/apps/config.py", line 142, in create
    app_module = import_module(app_name)
  File "/usr/local/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'sheets'

我的配置文件是:

LOCAL_APPS = (
    # custom users app
    'sorbetcitron.users.apps.UsersConfig',
    # Your stuff: custom apps go here
    'sorbetcitron.sheets.apps.SheetsConfig',
    'sorbetcitron.cashflows.apps.CashflowsConfig',

)

# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS

而我的项目目录是:

还有我的sorbetcitron.sheets.apps.py:

from django.apps import AppConfig


class SheetsConfig(AppConfig):
    name = 'sheets

'

我不明白的是我的第二个应用程序 "cashflows".

没有问题

AppConfig.name 必须是您的应用程序的路径。在你的代码中,你把 name = 'sheets' 而不是 name = 'sorbetcitron.sheets'

https://docs.djangoproject.com/en/stable/ref/applications/#for-application-authors