django - 调试 django-channels

标签 django pycharm django-channels

我正在尝试将 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/

相关文章:

python - 在 PyCharm 中为 Python 突出显示更复杂的语法?

python - https 背后的 django channel

不同 docker 容器之间的 Django channel

python - 在 DRF(django-rest-framework) 中, "author_id"列中的空值违反了非空约束。我应该怎么办?

django - 我可以在 django 中设置多个静态根吗?

python-3.x - 确保为位于 'pip' 的 Python 解释器安装了正确版本的 'dir:\projectPath\venv\Scripts\python.exe'

django - 使用pycharm在docker中运行django

python - 使用 Django 和 SQL Server 创建 Azure 网站

python - 是否可以将带有无关元素的字典传递给 Django object.create 方法?

django - 将 websockets 集成到 Django Rest Framework 应用程序的简单方法?