Thanks. 
I added a async http consumer from the doc. It kept throwing error on  
"Header name 'Content-Type' expected to be `bytes`, but got `<class 
'str'>`".
I was able to get it running after changing  to (b"Content-Type", b
"text/plain"),

from channels.generic.http import AsyncHttpConsumer
class BasicHttpConsumer(AsyncHttpConsumer):
    async def handle(self, body):
        await asyncio.sleep(10)
        await self.send_response(200, b"Your response bytes", headers=[
            (b"Content-Type", b"text/plain"),
        ])



On Wednesday, November 7, 2018 at 8:56:52 PM UTC-7, Andrew Godwin wrote:
>
> Channels doesn't take over at all unless you configure an async consumer. 
> To make sure it's working I'd recommend writing a single async consumer, 
> and running a test against that to ensure it works.
>
> Andrew
>
> On Wed, Nov 7, 2018 at 1:11 PM Zhiyu (Drew) Li <zyli...@gmail.com 
> <javascript:>> wrote:
>
>> Hi there,
>>
>> I am trying to migrate an existing Django project to Channels2. We want 
>> to keep all existing sync codes unchanged and we will continue mode of the 
>> development in sync mode. But having Channels opens the opportunity to 
>> develop some features in async mode.
>>
>> I was able to install channels2 and get it configured. The portal still 
>> runs and all tests passed. But does it mean the migration is successful? 
>> How can I know if the tests were actually run in the channels2 env?
>>
>> Anything particular I need to double check? like a migration checklist
>>
>> Thanks
>> Drew
>>
>> -- 
>> 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 <javascript:>.
>> To post to this group, send email to django...@googlegroups.com 
>> <javascript:>.
>> 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/CAMmsbU%3DzsYB5J7p4_mC1Gj3HqjiLRLo7Hc4UhaHEN_FXRv0ScA%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/django-users/CAMmsbU%3DzsYB5J7p4_mC1Gj3HqjiLRLo7Hc4UhaHEN_FXRv0ScA%40mail.gmail.com?utm_medium=email&utm_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/1f880fe4-2eab-4a41-bcce-f36f3bc77772%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to