美文网首页
安装Channels

安装Channels

作者: luopu | 来源:发表于2017-10-25 20:59 被阅读0次

Channels在PyPI上就有——安装只要运行:

pip install -U channels

运行完后,将channels添加到你的INSTALLED_APPS设置中:

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    ...
    'channels',
)

大功告成!设置好后,channels会将自己整合到Django中并且控制runserver命令。更多信息参见Getting Started with Channels.

注意

某些三方应用会重载或者取代 runserver 命令。Channels使用单独的 runserver 命令,可能会与这些三方应用冲突,比如whitenoisewhitenoise.runserver_nostatic。为了避免冲突,请将 channels 移到 INSTALLED_APPS 设置的首行,或者移除冲突的应用。

安装最新开发版

要安装最新的开发版本,请自己clone这个repo, 进入到repo的路径,然后在你的虚拟环境中用pip安装:

$ git clone git@github.com:django/channels.git
$ cd channels
$ <activate your project’s virtual environment>
(environment) $ pip install -e .  # the dot specifies the current repo

相关文章

网友评论

      本文标题:安装Channels

      本文链接:https://www.haomeiwen.com/subject/vxecpxtx.html