[英]Debugging django-channels
我正在尝试将django-channels合并到我的下一个项目中,但是调试时遇到了问题。 我已经尝试过pycharms调试器和pdb,但是它没有达到断点。
看看Django频道面板。 它是django调试工具栏的插件。 您可以在其中添加django-channels-panel,以将通道调试功能添加到项目中。 这样可以确保您可以在应用处于开发模式时引导详细信息。
https://github.com/Krukov/django-channels-panel
安装 [Django调试工具栏]
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',
]
安装 [Django频道面板]
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
将PYCHARM_DEBUG = True添加到环境变量为我解决了这个问题。
这增加了运行调试器时要输出的许多额外日志记录,但是即使从配置中删除了PYCHARM_DEBUG值,问题似乎仍然得以解决。
目前这对我有效:
在Python调试设置中,确保未选中Gevent-compatible
我认为没有其他必要。 更改此设置后,将击中我的断点,而勾选兼容Gevent时,它们将不会被击中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.