我正在尝试将 django-channels 合并到我的下一个项目中,但我在调试时遇到了问题。我已经尝试过 pycharms 调试器和 pdb,但它没有达到断点。
最佳答案
看看 django channel 面板。它是 django debug toolbar 的插件.您可以向其中添加 django-channels-panel 以将 channel 调试功能添加到您的项目中。这确保您可以在应用程序处于开发模式时 channel 详细信息。
https://github.com/Krukov/django-channels-panel
Installation [ Django debug toolbar ]
pip install django-debug-toolbar
在settings.py中
INSTALLED_APPS = [
# ...
'django.contrib.staticfiles',
# ...
'debug_toolbar',
]
MIDDLEWARE = [
# ...
'debug_toolbar.middleware.DebugToolbarMiddleware',
# ...
]
在 urls.py 中
from django.conf import settings
from django.conf.urls import include, url
if settings.DEBUG:
import debug_toolbar
urlpatterns += [
url(r'^__debug__/', include(debug_toolbar.urls)),
]
配置
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',
]
Installation [ Django channels panel ]
pip install django-channels-panel
add 'channels_panel' to your INSTALLED_APPS in settings.py
add 'channels_panel.panel.ChannelsDebugPanel' to your DEBUG_TOOLBAR_PANELS
关于django - 调试 django-channels,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39458513/