django-channels

Possible to serve Django Channels app only using Nginx and Daphne?

北战南征 提交于 2019-12-25 01:34:08
问题 I was under the assumption that I could run a Django Channels app using only Daphne (ASGI) and Nginx as a proxy for my Django app to begin with. The application would be running with Daphne on 127.0.0.1:8001 However, I am running into a 403 Forbidden error. 2019/03/06 17:45:40 [error] *1 directory index of "/home/user1/app/src/app/" is forbidden And when I posted about that, another user mentioned There is no directive to pass http request to django app in your nginx config And suggested to

Django Channels Postgres InterfaceError: connection already closed

为君一笑 提交于 2019-12-24 17:18:54
问题 I can't seem to wrap my head around the issue here. I'm writing tests for my Channel Consumers following the description in the docs. I'd normally use the Django default unittest but since Channels requires using pytest, I'm using it but will still like to maintain the class structure of writing tests. I had issues with writing the setup method similar to unittest which I would use to initialize the test attributes. I tried method fixtures, class fixtures using autouse=true, but none of them

django-channels: differentiate between different `AnonymousUser`s

被刻印的时光 ゝ 提交于 2019-12-24 09:03:03
问题 Unfortunately I'm using django-channels channels 1.1.8, as I missed all the updates to channels 2.0. Upgrading now is unrealistic as we've just launched and this will take some time to figure out correctly. Here's my problem: I'm using the *message.user.id *to differentiate between authenticated users that I need to send messages to. However, there are cases where I'll need to send messages to un-authenticated users as well - and that message depends on an external API call. I have done this

Django channels 2 with selenium test failed

≡放荡痞女 提交于 2019-12-24 00:59:46
问题 I am trying to follow Django channels tutorial. I was able to implement chat functionality as discribed here. But unittests completly copy pasted from this page failed with following error AttributeError: Can't pickle local object 'DaphneProcess.__init__.<locals>.<lambda>' . Full traceback: Traceback (most recent call last): File "C:\Users\user\PycharmProjects\django_channels_test\venv35\lib\site-packages\django\test\testcases.py", line 202, in __call__ self._pre_setup() File "C:\Users\user

Django Channels Websockets Connecting and Disconnecting right away

岁酱吖の 提交于 2019-12-23 20:01:57
问题 First some background, I am working off of this tutorial: https://blog.heroku.com/in_deep_with_django_channels_the_future_of_real_time_apps_in_django On Windows 64-bit using the Vagrant distribution of Redis from here: https://github.com/ServiceStack/redis-windows Using Python 3.4 and Django 1.10 I am able to clone, build and run the project fine. the problem is that when I access the django view through my browser it loads the chat fine but when I send a message in the console it says the

django channels websocket connect not working

半城伤御伤魂 提交于 2019-12-23 17:03:19
问题 I am trying to run the multichat project from django channels-examples on a server. It works locally on a windows machine but when I put this on the linux server and start it with runserver it does not: ./manage.py runserver Then when I call up the website, it is shown correctly but as soon as the JS sends it websocket request I always get this reponse: [2016/08/02 14:35:48] HTTP GET /chat/stream/ 404 [0.04, 127.0.0.1:40186] ....(many lines of this) So the websocket request is handled as an

PytestDeprecationWarning at test setup: the funcargnames attribute was an alias for fixturenames

喜欢而已 提交于 2019-12-23 09:00:07
问题 Following tutorial on https://testdriven.io/, I have created a websocket test for testing my websocket connection: # tests/test_websockets.py from django.contrib.auth import get_user_model from django.contrib.auth.models import Group from django.test import Client from channels.db import database_sync_to_async from channels.layers import get_channel_layer from channels.testing import WebsocketCommunicator from nose.tools import assert_equal, assert_is_none, assert_is_not_none, assert_true

How to send user notifications using django-channels 2.0?

你。 提交于 2019-12-23 05:29:38
问题 I am working on a chat app that has Rooms. Each room has two users. A user can be in multiple rooms i.e, a user has multiple rooms. And now he is chatting in one room. But he receives a message in another room. I would like to notify about the message from other room to the user. How should I implement this? Currently a websocket connection is established as: ws://localhost:8000/chat/int<room_id>/ And the group_name is named as "room"+room_id . and So far I have: async def connect(self): room

How to run Daphne Server (Django Channels) & workers in the background?

梦想与她 提交于 2019-12-23 03:29:09
问题 I have installed Django Channels. I am trying to run the following commands to run Daphne server and a worker. > daphne chat.asgi:channel_layer --port $PORT --bind 0.0.0.0 -v2 > python manage.py runworker -v2 But each command opens up a live terminal showing logs. I just want to run them as background processes. Can anyone show me how to do this? 回答1: For these type of tasks, you should use supervisor. 回答2: At the moment nohup & is working alright for me. The following commands run the

Cannot import ASGI_APPLICATION module while runserver using channels 2

删除回忆录丶 提交于 2019-12-22 04:01:08
问题 I have followed the channels tutorial but while running these error throw Version of the packages is channels==2.1.2 Django==2.0.4 what I missed ? in settings.py INSTALLED_APPS = [ "channels" .... ] ROOT_URLCONF = 'myapp.urls' ASGI_APPLICATION = "myapp.routing.application" added file mayapp/routing.py from channels.routing import ProtocolTypeRouter application = ProtocolTypeRouter({ # Empty for now (http->django views is added by default) }) this is the error log System check identified no