在尝试使用python manage.py runserver
进行迁移时,我得到了以下回溯:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/infinity/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/infinity/.virtualenvs/project/lib/python3.6/site-packages/django/core/management/__init__.py", line 338, in execute
django.setup()
File "/home/infinity/.virtualenvs/project/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/infinity/.virtualenvs/project/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/infinity/.virtualenvs/project/lib/python3.6/site-packages/django/apps/config.py", line 94, in create
module = import_module(entry)
File "/home/infinity/.virtualenvs/project/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'debug_toolbar'
以下是设置文件的一部分
from .common import * # noqa
DEV = True
DEBUG = True
STAGE = 'dev'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
USERENA_USE_HTTPS = False
ALLOWED_HOSTS = ['127.0.0.1', 'localhost']
INSTALLED_APPS = INSTALLED_APPS + [
'debug_toolbar',
'django_extensions',
]
MIDDLEWARE = MIDDLEWARE + [
'debug_toolbar.middleware.DebugToolbarMiddleware',
]
DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.versions.VersionsPanel',
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
]
DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': False,
}
我无法解释为什么永远不会加载此应用。我现在正在努力解决这个问题。任何人都有时间帮助我吗?
答案 0 :(得分:1)
试试这个:pip install django-debug-toolbar