I cannot say I'm good at submitting issues etc. But I'm going to try it. So I hope this will help. I just faced an error when I'm trying to run the databinding example which is in your channels-examples repo.
My channels version is 0.17.2 and I installed it from pip. Here is the error:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/lib/python3.5/site-packages/django/core/management/__init__.py", line 341, in execute
django.setup()
File "/usr/lib/python3.5/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/lib/python3.5/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/usr/lib/python3.5/site-packages/django/apps/config.py", line 199, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/lexygon/Downloads/channels-examples-master/databinding/values/models.py", line 2, in <module>
from channels.binding.websockets import WebsocketBinding
File "/usr/lib/python3.5/site-packages/channels/binding/__init__.py", line 1, in <module>
from .base import Binding # NOQA isort:skip
File "/usr/lib/python3.5/site-packages/channels/binding/base.py", line 8, in <module>
from ..channel import Group
File "/usr/lib/python3.5/site-packages/channels/channel.py", line 5, in <module>
from channels import DEFAULT_CHANNEL_LAYER, channel_layers
ImportError: cannot import name 'DEFAULT_CHANNEL_LAYER'
That is very unusual indeed. Could you run this in a python shell in the same environment and paste the result here?
import channels; print(dir(channels))
Here it is:
Python 3.5.2 (default, Jun 28 2016, 08:46:01)
[GCC 6.1.1 20160602] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import channels; print(dir(channels))
['ImproperlyConfigured', '_BACKENDS', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_load_backend', '_load_django_settings', '_load_module', '_send', 'absolute_import', 'exceptions', 'send', 'sys', 'unicode_literals']
>>>
That's not the main Channels package you're importing there. Could do you this to see what it is?
import channels; print(channels.__file__)
Here it is. I forgot to say I'm not using it in a virtualenv. I hope it is not necessary :)
Python 3.5.2 (default, Jun 28 2016, 08:46:01)
[GCC 6.1.1 20160602] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import channels; print(channels.__file__)
/usr/lib/python3.5/site-packages/channels/__init__.py
>>>
edit: I installed Channels in a virtualenv and checked the files. Everything okay. Codes are same with github. But when I install it from pip without virtualenv the files are not same. There is a "backend" folder and many of codes are different etc. But I don't know why this happens. I think it is about pip
Did you by chance use pip install django_channels? I did the same at first. Try pip install channels.
This other project shares the same namespace: https://github.com/ymyzk/django-channels
Closing, since I suspect that's exactly what happened.
Happened to me too, if channels is properly installed a message saying ASGI/Channels development server is runnning should appear in your logs, not development server.
Most helpful comment
Did you by chance use
pip install django_channels? I did the same at first. Trypip install channels.This other project shares the same namespace: https://github.com/ymyzk/django-channels