當通過碼頭工人和碼頭工人,撰寫的runserver運行,我得到這個錯誤,我無法連接到Django的:Django的通道和碼頭工人,撰寫錯誤
django_1 | 2017-01-09 08:24:44,328 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
django_1 | 2017-01-09 08:24:44,329 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
django_1 | 2017-01-09 08:24:44,331 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
django_1 | 2017-01-09 08:24:44,331 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
django_1 | Unhandled exception in thread started by <function wrapper at 0x7ff06bee5d70>
django_1 | Traceback (most recent call last):
django_1 | File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
django_1 | fn(*args, **kwargs)
django_1 | File "/usr/local/lib/python2.7/site-packages/channels/management/commands/runserver.py", line 84, in inner_run
django_1 | Performing system checks...
django_1 |
django_1 | System check identified no issues (0 silenced).
django_1 | January 09, 2017 - 08:24:44
django_1 | Django version 1.10.4, using settings 'backend.settings'
django_1 | Starting Channels development server at http://0.0.0.0:8000/
django_1 | Channel layer default (asgi_redis.core.RedisChannelLayer)
django_1 | Quit the server with CONTROL-C.
django_1 | ws_protocols=getattr(settings, 'CHANNELS_WS_PROTOCOLS', None),
django_1 | File "/usr/local/lib/python2.7/site-packages/daphne/server.py", line 41, in __init__
django_1 | ''' % self.__class__.__name__)
django_1 | DeprecationWarning:
django_1 | The host/port/unix_socket/file_descriptor keyword arguments to Server are deprecated.
django_1 |
在本地運行,一切都運行正常。 這裏是我的requirements.txt:
Django的== 1.10.4 psycopg2 == 2.6.2 渠道== 0.17.3 ASGI,Redis的== 1.0.0
而這裏的我的碼頭 - 撰寫文件:
version: '2'
services:
redis:
image: redis:3.0-alpine
postgres:
image: postgres
django:
build: ../backend
command: python backend/manage.py runserver 0.0.0.0:8000
volumes:
- ../backend:/backend
ports:
- "8000:8000"
depends_on:
- postgres
- redis
- django-migration
django-migration:
build: ../backend
command: python backend/manage.py migrate
volumes:
- ../backend:/backend
depends_on:
- postgres
client:
image: node
command: bash -c "cd src && npm start"
ports:
- "3000:3000"
任何想法?
你是什麼意思,他們沒有鏈接到對方?我確定他們的確做到了99.9%,因爲我可以通過他們的主機名訪問任何容器中的所有其他主機。我已經用inmemory asgi成功運行了這個docker-compose文件,現在我添加了redis,這導致了問題。 – Nirri
好的,如果您確定容器已鏈接,我的回答是錯誤的。可能是當你嘗試連接到redis時,它還沒有啓動? –
謝謝,但我發現問題的同時,我發佈在下面 – Nirri