简体   繁体   English

启动服务器时Django通道出错

[英]Django channels Error when starting the server

I have my channels placed in the top of INSTALLED_APPS.我将我的频道放在 INSTALLED_APPS 的顶部。

When I ty to start the server I get following error:当我启动服务器时,出现以下错误:

  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 224, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 36, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\channels\management\commands\runserver.py", line 10, in <module>
    from channels import __version__
ImportError: cannot import name '__version__' from 'channels' (C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\channels\__init__.py)```

I just was Installing django_channels not right way.我只是以不正确的方式安装 django_channels。 I should install django_channels throught that way python -m pip install -U channels , Not throught pip isnstall django_channels .我应该通过这种方式安装 django_channels python -m pip install -U channels ,而不是通过pip isnstall django_channels

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM