Re: Channels 2.0 max number of connections

2018-04-06 Thread Алексей Кузуб
Or I was wrong and the solution is using "from twisted.internet import 
iocpreactor" instead of "from twisted.internet import reactor"

пятница, 6 апреля 2018 г., 12:32:19 UTC+3 пользователь Алексей Кузуб 
написал:
>
> Thank you, Andrew!
> I try to simulate 1.000 connections and I got exception ValueError: too 
> many file descriptors in select(). I use Windows OS.
> I found the solution of this problem here 
> https://docs.python.org/3/library/asyncio-eventloops.html#asyncio.ProactorEventLoop
> Is there some way to use it with Channels and Daphne?
>
> четверг, 5 апреля 2018 г., 9:41:30 UTC+3 пользователь Andrew Godwin 
> написал:
>>
>> No, there is no hard limit programmed into Daphne. It will keep accepting 
>> as long as it can.
>>
>> Andrew
>>
>> On Wed, Apr 4, 2018 at 11:30 PM, Алексей Кузуб <roni...@gmail.com> wrote:
>>
>>> But no limit in params or in some other place?
>>>
>>> среда, 4 апреля 2018 г., 20:00:11 UTC+3 пользователь Andrew Godwin 
>>> написал:
>>>>
>>>> It depends on your server and how busy the connections are. If you need 
>>>> more you should run more instances of Daphne.
>>>>
>>>> Andrew
>>>>
>>>> On Wed, 4 Apr 2018, 05:21 Алексей Кузуб, <roni...@gmail.com> wrote:
>>>>
>>>>> Hello! How many connections Channels 2.0 can handle and keep open 
>>>>> simultaneously? And how should I configure Daphne that increases this 
>>>>> number?
>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to django-users...@googlegroups.com.
>>>>> To post to this group, send email to django...@googlegroups.com.
>>>>> Visit this group at https://groups.google.com/group/django-users.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/django-users/641b59f8-ed76-4a08-a7f2-06963e7d183f%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/django-users/641b59f8-ed76-4a08-a7f2-06963e7d183f%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/9602d8c9-3316-4455-b14c-9da9e20217b8%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/9602d8c9-3316-4455-b14c-9da9e20217b8%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a3761dce-6ffe-406c-b0fc-a4dd952d87fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels 2.0 max number of connections

2018-04-06 Thread Алексей Кузуб
Thank you, Andrew!
I try to simulate 1.000 connections and I got exception ValueError: too 
many file descriptors in select(). I use Windows OS.
I found the solution of this problem here 
https://docs.python.org/3/library/asyncio-eventloops.html#asyncio.ProactorEventLoop
Is there some way to use it with Channels and Daphne?

четверг, 5 апреля 2018 г., 9:41:30 UTC+3 пользователь Andrew Godwin написал:
>
> No, there is no hard limit programmed into Daphne. It will keep accepting 
> as long as it can.
>
> Andrew
>
> On Wed, Apr 4, 2018 at 11:30 PM, Алексей Кузуб <roni...@gmail.com 
> > wrote:
>
>> But no limit in params or in some other place?
>>
>> среда, 4 апреля 2018 г., 20:00:11 UTC+3 пользователь Andrew Godwin 
>> написал:
>>>
>>> It depends on your server and how busy the connections are. If you need 
>>> more you should run more instances of Daphne.
>>>
>>> Andrew
>>>
>>> On Wed, 4 Apr 2018, 05:21 Алексей Кузуб, <roni...@gmail.com> wrote:
>>>
>>>> Hello! How many connections Channels 2.0 can handle and keep open 
>>>> simultaneously? And how should I configure Daphne that increases this 
>>>> number?
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to django-users...@googlegroups.com.
>>>> To post to this group, send email to django...@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/django-users/641b59f8-ed76-4a08-a7f2-06963e7d183f%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/641b59f8-ed76-4a08-a7f2-06963e7d183f%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/9602d8c9-3316-4455-b14c-9da9e20217b8%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/9602d8c9-3316-4455-b14c-9da9e20217b8%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/50bd42a4-7110-4205-8f9b-32529663db3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels 2.0 max number of connections

2018-04-05 Thread Алексей Кузуб
But no limit in params or in some other place?

среда, 4 апреля 2018 г., 20:00:11 UTC+3 пользователь Andrew Godwin написал:
>
> It depends on your server and how busy the connections are. If you need 
> more you should run more instances of Daphne.
>
> Andrew
>
> On Wed, 4 Apr 2018, 05:21 Алексей Кузуб, <roni...@gmail.com > 
> wrote:
>
>> Hello! How many connections Channels 2.0 can handle and keep open 
>> simultaneously? And how should I configure Daphne that increases this 
>> number?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/641b59f8-ed76-4a08-a7f2-06963e7d183f%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/641b59f8-ed76-4a08-a7f2-06963e7d183f%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9602d8c9-3316-4455-b14c-9da9e20217b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Channels 2.0 max number of connections

2018-04-04 Thread Алексей Кузуб
Hello! How many connections Channels 2.0 can handle and keep open 
simultaneously? And how should I configure Daphne that increases this 
number?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/641b59f8-ed76-4a08-a7f2-06963e7d183f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Search by entering to value in JSONField PostgreSQL

2018-03-24 Thread Алексей Кузуб
Thank's for your answer. As I know when we are using JSONField Django translate 
__contains in SQL with @> that check entering json in json. So it can't help me.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/142edfb4-d7e4-4490-a958-ce4a3b05d015%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Search by entering to value in JSONField PostgreSQL

2018-03-23 Thread Алексей Кузуб


Hi! I work with poorly structured data. I use EAV. But I want to replace 
EAV with jsonb in postgresql. I need to do a search by entering to value in 
json.values(). Is it possible? Is there some decision on Django or SQL?For 
example, there is the model

class SomeModel(models.Model):
data = JSONField()

That jsons stored in rows in data field:

{"name": "Michael", "friend_name": "Sara"}
{"name": "Miranda", "friend_name": "Richard"}

If I type "ar" in search input I want to get both rows("ar" in "Sara", "ar" 
in "Miranda"), "cha" - both rows( "cha" in "Michael", "ar" in "Richard"), 
"ir" - only one ("ir" in "Miranda"), "asdq" - nothing. Is it possible with 
Django? Is it possible with SQL? Thank you and sorry for my English.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a3bb18e9-c513-493b-a3a8-5f8da1a40b81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Daphne and Intermediate certificate

2017-05-04 Thread Алексей Кузуб
Thank you very much, Andrew! It works!

четверг, 4 мая 2017 г., 19:39:49 UTC+3 пользователь Andrew Godwin написал:
>
> You can - if you use the `-e` method of passing arguments to Daphne, as a 
> couple of the examples in the README show, you can use the full Twisted 
> endpoint syntax, which allows a extraCertChain parameter.
>
> You can see their documentation here, including example syntax for how 
> that would look: 
> https://twistedmatrix.com/documents/current/core/howto/endpoints.html#servers
>
> Andrew
>
> On Thu, May 4, 2017 at 7:25 AM, Алексей Кузуб <roni...@gmail.com 
> > wrote:
>
>> Hi! I cam using Django channels and Daphne web server. And I want to use 
>> web sockets with it over https i.e using SSL. Can Daphne use intermediate 
>> certificates and how i can to run this stack?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/00b0e2b3-801b-4f89-abaa-8d0b47a0a7f0%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/00b0e2b3-801b-4f89-abaa-8d0b47a0a7f0%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/68a7f50c-11e2-4f79-8fe8-e6954b2db7c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Daphne and Intermediate certificate

2017-05-04 Thread Алексей Кузуб
Hi! I cam using Django channels and Daphne web server. And I want to use 
web sockets with it over https i.e using SSL. Can Daphne use intermediate 
certificates and how i can to run this stack?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/00b0e2b3-801b-4f89-abaa-8d0b47a0a7f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels, more than one project

2017-03-27 Thread Алексей Кузуб
Thank you very much, Andrew! It works for two independent layers. You are 
really cool and really helped me once again! =)

пятница, 24 марта 2017 г., 16:25:42 UTC+3 пользователь Andrew Godwin 
написал:
>
> Run two Daphne instances, each with a different channel layer configured. 
> To make sure the channel layers for the apps do not conflict, configure 
> them either with different Redis servers or different values for the 
> "prefix" argument to the channel layer on the same server.
>
> Andrew
>
> On Fri, Mar 24, 2017 at 1:02 AM, Алексей Кузуб <roni...@gmail.com 
> > wrote:
>
>> Hello! I am using Django channels with daphne. And I want to deploy two 
>> projects on one server. How can I do it? Should I run two daphnes or do 
>> some routing? And how can I separate workers for two daphnes?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/5241949e-47fa-44f7-a65a-1bbf16a7dc13%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/5241949e-47fa-44f7-a65a-1bbf16a7dc13%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/abeb58e1-4de3-402d-a46b-d58d966bb698%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django channels, more than one project

2017-03-24 Thread Алексей Кузуб
Hello! I am using Django channels with daphne. And I want to deploy two 
projects on one server. How can I do it? Should I run two daphnes or do 
some routing? And how can I separate workers for two daphnes?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5241949e-47fa-44f7-a65a-1bbf16a7dc13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels

2017-02-07 Thread Алексей Кузуб
It works! I configure all from scratch step by step and it works! But I 
didn't find the reason of my problem. Maybe it was IIS or some Windows app 
=)
Thank you very much, Andrew! You really helped me.

понедельник, 6 февраля 2017 г., 20:34:03 UTC+3 пользователь Andrew Godwin 
написал:
>
> The errors you're getting both point to Channels not using your second two 
> routes, but I've tried a similar routing locally and it works fine for me. 
> Is there a chance you could make this into a small sample project that 
> reproduces the issue?
>
> You could also try clearing any .pyc files or __pycache__ directories to 
> make sure it's not some old code being cached, and making sure there's not 
> a "routing" directory that clashes with routing.py
>
> Andrew
>
> On Sun, Feb 5, 2017 at 11:54 PM, Алексей Кузуб <roni...@gmail.com 
> > wrote:
>
>> And workers write me 
>> 2017-02-06 10:42:04,709 - DEBUG - worker - Got message on 
>> websocket.connect (rep
>> ly websocket.send!FlEitltfgsCC)
>> 2017-02-06 10:42:04,710 - DEBUG - runworker - websocket.connect
>> 2017-02-06 10:42:04,711 - DEBUG - worker - Dispatching message on 
>> websocket.conn
>> ect to channels.routing.connect_consumer
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/71618c7e-dbe4-4a76-b873-e35fa410f942%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/71618c7e-dbe4-4a76-b873-e35fa410f942%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2e5f0356-be38-494b-b5a8-91bfeccd936d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels

2017-02-05 Thread Алексей Кузуб
And workers write me 
2017-02-06 10:42:04,709 - DEBUG - worker - Got message on websocket.connect 
(rep
ly websocket.send!FlEitltfgsCC)
2017-02-06 10:42:04,710 - DEBUG - runworker - websocket.connect
2017-02-06 10:42:04,711 - DEBUG - worker - Dispatching message on 
websocket.conn
ect to channels.routing.connect_consumer

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/71618c7e-dbe4-4a76-b873-e35fa410f942%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels

2017-02-05 Thread Алексей Кузуб
Websocket.connect does not work. Http.request works only. I try to use 
'ws_message' 
with .connect to obtain some mistake. But no mistake was. Daphne writes me 
193.150.110.228:58244 - - [06/Feb/2017:10:42:04] "WSCONNECTING /" - -
2017-02-06 10:42:04,709 DEBUGUpgraded connection 
http.response!hgLdPnoqcAkn
to WebSocket websocket.send!FlEitltfgsCC
2017-02-06 10:42:04,713 DEBUGWebSocket websocket.send!FlEitltfgsCC open 
and
established
193.150.110.228:58244 - - [06/Feb/2017:10:42:04] "WSCONNECT /" - -
2017-02-06 10:42:04,714 DEBUGWebSocket websocket.send!FlEitltfgsCC 
accepted
by application

Versions: Django 1.10.4, Python 3.5.2, Channels 1.0.2, Daphne 1.0.1. And 
another stack: Django 1.10.5, Python 3.6.0, Channels 1.0.3, Daphne 1.0.2.
Maybe it's some conflict with some apps like python-social-auth or Django 
REST Framework? Or maybe some problems with Redis? Can I check it?

понедельник, 6 февраля 2017 г., 3:23:37 UTC+3 пользователь Andrew Godwin 
написал:
>
> I'm surprised that's working, as you've tied `connect` to a consumer that 
> is designed for `receive` messages - in particular, a `connect` message 
> should not have a `text` key. Are you sure sockets are connecting alright?
>
> If they are though, the rest looks like it should work. What versions of 
> Channels/Daphne/Django/Python are you using?
>
> Andrew 
>
> On Sun, Feb 5, 2017 at 12:55 PM, Алексей Кузуб <roni...@gmail.com 
> > wrote:
>
>> settings.py
>>
>> redis_host = os.environ.get('REDIS_HOST', 'localhost')
>>
>> CHANNEL_LAYERS = {
>> 'default': {
>> 'BACKEND': 'asgi_redis.RedisChannelLayer',
>> 'CONFIG': {
>> 'hosts': [(redis_host, 6379)],
>> },
>> 'ROUTING': 'VoteMagic.routing.channel_routing',
>> },
>> }
>>
>>
>> asgi.py
>>
>> import os
>> from channels.asgi import get_channel_layer
>>
>> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "VoteMagic.settings")
>>
>> channel_layer = get_channel_layer()
>>
>>
>> routing.py
>>
>> from channels.routing import route
>> from votes.consumers import ws_message
>>
>> channel_routing = [
>> route("http.request", "votes.consumers.http_consumer"),
>> route("websocket.connect", ws_message),
>> route("websocket.receive", ws_message),
>> ]
>>
>>
>> consumers.py
>>
>> from django.http import HttpResponse
>> from channels.handler import AsgiHandler
>>
>>
>> def http_consumer(message):
>> response = HttpResponse("Hello world! You asked for %s" % 
>> message.content['path'])
>> for chunk in AsgiHandler.encode_response(response):
>> message.reply_channel.send(chunk)
>>
>>
>> def ws_message(message):
>> message.reply_channel.send({
>> "text": message.content['text'],
>> })
>>
>>
>> This is my code. And when I use http.request It's work! But when I try 
>> websockets result is nothing.
>>
>>
>>
>> воскресенье, 5 февраля 2017 г., 3:12:30 UTC+3 пользователь Andrew Godwin 
>> написал:
>>>
>>> "Dispatching message on websocket.receive to 
>>> channels.routing.null_consumer" 
>>> means that you don't have a consumer tied to the "websocket.receive" 
>>> channel, so Channels is sending it nowhere. Did you set up your routing 
>>> correctly?
>>>
>>> Andrew
>>>
>>> On Sat, Feb 4, 2017 at 2:41 AM, Алексей Кузуб <roni...@gmail.com> wrote:
>>>
>>>> Hello! I'm using django channels. I deployed it in IIS 8 and it's work 
>>>> on http.request. But when I try to use websocket result is nothing. Daphne 
>>>> writes me "Websocket incoming frame on websocket.send!toke". Workers write 
>>>> me "Dispatching message on websocket.receive to 
>>>> channels.routing.null_consumer". Say me, please. What i'm doing wrong? 
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to django-users...@googlegroups.com.
>>>> To post to this group, send email to django...@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit 
>>>> https://groups.go

Re: Django channels

2017-02-05 Thread Алексей Кузуб
settings.py

redis_host = os.environ.get('REDIS_HOST', 'localhost')

CHANNEL_LAYERS = {
'default': {
'BACKEND': 'asgi_redis.RedisChannelLayer',
'CONFIG': {
'hosts': [(redis_host, 6379)],
},
'ROUTING': 'VoteMagic.routing.channel_routing',
},
}


asgi.py

import os
from channels.asgi import get_channel_layer

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "VoteMagic.settings")

channel_layer = get_channel_layer()


routing.py

from channels.routing import route
from votes.consumers import ws_message

channel_routing = [
route("http.request", "votes.consumers.http_consumer"),
route("websocket.connect", ws_message),
route("websocket.receive", ws_message),
]


consumers.py

from django.http import HttpResponse
from channels.handler import AsgiHandler


def http_consumer(message):
response = HttpResponse("Hello world! You asked for %s" % 
message.content['path'])
for chunk in AsgiHandler.encode_response(response):
message.reply_channel.send(chunk)


def ws_message(message):
message.reply_channel.send({
"text": message.content['text'],
})


This is my code. And when I use http.request It's work! But when I try 
websockets result is nothing.



воскресенье, 5 февраля 2017 г., 3:12:30 UTC+3 пользователь Andrew Godwin 
написал:
>
> "Dispatching message on websocket.receive to channels.routing.null_consumer" 
> means that you don't have a consumer tied to the "websocket.receive" 
> channel, so Channels is sending it nowhere. Did you set up your routing 
> correctly?
>
> Andrew
>
> On Sat, Feb 4, 2017 at 2:41 AM, Алексей Кузуб <roni...@gmail.com 
> > wrote:
>
>> Hello! I'm using django channels. I deployed it in IIS 8 and it's work on 
>> http.request. But when I try to use websocket result is nothing. Daphne 
>> writes me "Websocket incoming frame on websocket.send!toke". Workers write 
>> me "Dispatching message on websocket.receive to 
>> channels.routing.null_consumer". Say me, please. What i'm doing wrong? 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/f67d74a0-fb8e-4d7e-abaa-e124befff531%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/f67d74a0-fb8e-4d7e-abaa-e124befff531%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f8b65128-7d9e-4866-9564-e9fce8699b40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django channels

2017-02-04 Thread Алексей Кузуб
Hello! I'm using django channels. I deployed it in IIS 8 and it's work on 
http.request. But when I try to use websocket result is nothing. Daphne 
writes me "Websocket incoming frame on websocket.send!toke". Workers write 
me "Dispatching message on websocket.receive to 
channels.routing.null_consumer". Say me, please. What i'm doing wrong? 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f67d74a0-fb8e-4d7e-abaa-e124befff531%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels on IIS

2017-01-27 Thread Алексей Кузуб
Port 8081 - same problem. I run it with administrator permissions.

пятница, 27 января 2017 г., 11:15:48 UTC+3 пользователь Jani Tiainen 
написал:
>
> Hi,
>
> Most probably accesses to ports below 1024 requires that you start daphne 
> from administrator elevated prompt.
>
> On 27.01.2017 09:52, Алексей Кузуб wrote:
>
> I have IIS, and i ran IIS in front of Daphne which handle SSL. But when i 
> run daphne to listen port which support https in IIS, daphne tell me  
> "2017-01-27 10:19:37,082 CRITICAL Unhandled error in Deferred: 
> 2017-01-27 10:19:37,082 CRITICAL
> Traceback (most recent call last):
>   File "c:\python35\lib\site-packages\twisted\internet\tcp.py", line 981, 
> in startListening
> skt.bind(addr)
> OSError: [WinError 10013] An attempt was made to access a socket in a way 
> forbidden by its access pe
> rmissions
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "c:\python35\lib\site-packages\twisted\internet\defer.py", line 
> 121, in execute
> result = callable(*args, **kw)
>   File "c:\python35\lib\site-packages\twisted\internet\posixbase.py", line 
> 478, in listenTCP
> p.startListening()
>   File "c:\python35\lib\site-packages\twisted\internet\tcp.py", line 983, 
> in startListening
> raise CannotListenError(self.interface, self.port, le)
> twisted.internet.error.CannotListenError: Couldn't listen on 0.0.0.0:1001: 
> [WinError 10013] An attem
> pt was made to access a socket in a way forbidden by its access 
> permissions."
> I tried different ports, which allowed in firewall. What i am doing wrong?
> пятница, 27 января 2017 г., 10:27:52 UTC+3 пользователь Sgiath написал: 
>>
>> Yes you can.
>> daphne -e ssl:443:privateKey=key.pem:certKey=crt.pem 
>> django_project.asgi:channel_layer 
>>
>> For more info look at the Daphne GitHub repo 
>> <https://github.com/django/daphne/>https://github.com/django/daphne/
>>
>> But I would suggest run Nginx in front of the Daphne which will handle 
>> SSL.
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> <https://groups.google.com/d/msgid/django-users/4d9a0247-c5d0-4733-980f-dd991d871719%40googlegroups.com?utm_medium=email_source=footer>
> https://groups.google.com/d/msgid/django-users/4d9a0247-c5d0-4733-980f-dd991d871719%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> Jani Tiainen
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d742f20d-b74b-441c-a908-0184b0112b36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels on IIS

2017-01-26 Thread Алексей Кузуб
I have IIS, and i ran IIS in front of Daphne which handle SSL. But when i 
run daphne to listen port which support https in IIS, daphne tell me 
"2017-01-27 10:19:37,082 CRITICAL Unhandled error in Deferred:
2017-01-27 10:19:37,082 CRITICAL
Traceback (most recent call last):
  File "c:\python35\lib\site-packages\twisted\internet\tcp.py", line 981, 
in startListening
skt.bind(addr)
OSError: [WinError 10013] An attempt was made to access a socket in a way 
forbidden by its access pe
rmissions

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\python35\lib\site-packages\twisted\internet\defer.py", line 121, 
in execute
result = callable(*args, **kw)
  File "c:\python35\lib\site-packages\twisted\internet\posixbase.py", line 
478, in listenTCP
p.startListening()
  File "c:\python35\lib\site-packages\twisted\internet\tcp.py", line 983, 
in startListening
raise CannotListenError(self.interface, self.port, le)
twisted.internet.error.CannotListenError: Couldn't listen on 0.0.0.0:1001: 
[WinError 10013] An attem
pt was made to access a socket in a way forbidden by its access 
permissions."
I tried different ports, which allowed in firewall. What i am doing wrong?
пятница, 27 января 2017 г., 10:27:52 UTC+3 пользователь Sgiath написал:
>
> Yes you can.
> daphne -e ssl:443:privateKey=key.pem:certKey=crt.pem 
> django_project.asgi:channel_layer
>
> For more info look at the Daphne GitHub repo 
> https://github.com/django/daphne/
>
> But I would suggest run Nginx in front of the Daphne which will handle SSL.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4d9a0247-c5d0-4733-980f-dd991d871719%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels on IIS

2017-01-26 Thread Алексей Кузуб
Thank you! Maybe i'll try it. One more question...can i use daphne by https?

четверг, 26 января 2017 г., 14:59:37 UTC+3 пользователь Avraham Serour 
написал:
>
> if you are stuck on windows but not necessarily IIS you may try cygwin, I 
> once had to deploy on windows and after investigating some possibilities I 
> just installed cygwin and put nginx with uwsgi.
>
> On Thu, Jan 26, 2017 at 9:55 AM, Алексей Кузуб <roni...@gmail.com 
> > wrote:
>
>> Thank you for your answers and advices. I have no possibility to use *nix 
>> platform, my employer wants it on IIS. I'll try to build it, thank you very 
>> much!
>>
>> среда, 25 января 2017 г., 21:14:22 UTC+3 пользователь Jani Tiainen 
>> написал:
>>>
>>> There exists 3rd party ASGI handler for IIS: 
>>> https://github.com/mjkillough/iis-asgi-handler/ 
>>>
>>> It also requires at least IIS 8 and websocket protocol installed. More 
>>> details at 
>>> https://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support
>>>
>>> Note, you need to build that handler yourself, which then requires 
>>> another set of tools, visual studio 2015 and CMake 2.8+
>>>
>>> Also note that there is not much of installation instructions or how to 
>>> build package that you can just install to your server without installing 
>>> all the development tools there.
>>>
>>> I really suggest that you try to find some *nix platform to run required 
>>> parts, it's just plain simpler and more documented than IIS.
>>>
>>> On Wed, Jan 25, 2017 at 7:25 PM, Andrew Godwin <and...@aeracode.org> 
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am afraid I don't have experience using IIS - I don't know if it even 
>>>> supports HTTP/1.1 proxying, which is needed for WebSockets. Hopefully 
>>>> someone else can help.
>>>>
>>>> Andrew
>>>>
>>>> On Wed, Jan 25, 2017 at 6:35 AM, Алексей Кузуб <roni...@gmail.com> 
>>>> wrote:
>>>>
>>>>> I have a project in Django and i want to use django channels for 
>>>>> support websockets in my project, but i have a problem with IIS 
>>>>> configuration. Could somebody helps me with configuration daphne in IIS 
>>>>> or 
>>>>> configuration IIS to support channels and daphne. Has somebody any 
>>>>> expierence in it? And maybe somebody knows some ways to deploy 
>>>>> django+channels on IIS with or without daphne?
>>>>> Sorry for my bad english.
>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to django-users...@googlegroups.com.
>>>>> To post to this group, send email to django...@googlegroups.com.
>>>>> Visit this group at https://groups.google.com/group/django-users.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/django-users/9364bca2-2a03-4ae7-b93b-ff105ff34d31%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/django-users/9364bca2-2a03-4ae7-b93b-ff105ff34d31%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to django-users...@googlegroups.com.
>>>> To post to this group, send email to django...@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/django-users/CAFwN1urM2A4HBhPzbG4_Tgs_DKzab39-Pz_jzWa981AGfC0cYg%40mail.gmail.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/CAFwN1urM2A4HBhPzbG4_Tgs_DKzab39-Pz_jzWa981AGfC0cYg%40mail.gmail.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> -- 
>>> Jani Tiainen
>>&g

Re: Django channels on IIS

2017-01-25 Thread Алексей Кузуб
Thank you for your answers and advices. I have no possibility to use *nix 
platform, my employer wants it on IIS. I'll try to build it, thank you very 
much!

среда, 25 января 2017 г., 21:14:22 UTC+3 пользователь Jani Tiainen написал:
>
> There exists 3rd party ASGI handler for IIS: 
> https://github.com/mjkillough/iis-asgi-handler/ 
>
> It also requires at least IIS 8 and websocket protocol installed. More 
> details at 
> https://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support
>
> Note, you need to build that handler yourself, which then requires another 
> set of tools, visual studio 2015 and CMake 2.8+
>
> Also note that there is not much of installation instructions or how to 
> build package that you can just install to your server without installing 
> all the development tools there.
>
> I really suggest that you try to find some *nix platform to run required 
> parts, it's just plain simpler and more documented than IIS.
>
> On Wed, Jan 25, 2017 at 7:25 PM, Andrew Godwin <and...@aeracode.org 
> > wrote:
>
>> Hi,
>>
>> I am afraid I don't have experience using IIS - I don't know if it even 
>> supports HTTP/1.1 proxying, which is needed for WebSockets. Hopefully 
>> someone else can help.
>>
>> Andrew
>>
>> On Wed, Jan 25, 2017 at 6:35 AM, Алексей Кузуб <roni...@gmail.com 
>> > wrote:
>>
>>> I have a project in Django and i want to use django channels for support 
>>> websockets in my project, but i have a problem with IIS configuration. 
>>> Could somebody helps me with configuration daphne in IIS or configuration 
>>> IIS to support channels and daphne. Has somebody any expierence in it? And 
>>> maybe somebody knows some ways to deploy django+channels on IIS with or 
>>> without daphne?
>>> Sorry for my bad english.
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com 
>>> .
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/9364bca2-2a03-4ae7-b93b-ff105ff34d31%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/9364bca2-2a03-4ae7-b93b-ff105ff34d31%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAFwN1urM2A4HBhPzbG4_Tgs_DKzab39-Pz_jzWa981AGfC0cYg%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/django-users/CAFwN1urM2A4HBhPzbG4_Tgs_DKzab39-Pz_jzWa981AGfC0cYg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Jani Tiainen
>
> - Well planned is half done, and a half done has been sufficient before...
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/636597f8-5b05-403a-b118-e5e84a841b19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django channels on IIS

2017-01-25 Thread Алексей Кузуб
I have a project in Django and i want to use django channels for support 
websockets in my project, but i have a problem with IIS configuration. 
Could somebody helps me with configuration daphne in IIS or configuration 
IIS to support channels and daphne. Has somebody any expierence in it? And 
maybe somebody knows some ways to deploy django+channels on IIS with or 
without daphne?
Sorry for my bad english.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9364bca2-2a03-4ae7-b93b-ff105ff34d31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.