Discussion:
Channel: Migrate regular Django project to Channels2
Zhiyu (Drew) Li
2018-11-07 21:11:14 UTC
Permalink
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.
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/CAMmsbU%3DzsYB5J7p4_mC1Gj3HqjiLRLo7Hc4UhaHEN_FXRv0ScA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Andrew Godwin
2018-11-08 03:56:09 UTC
Permalink
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
Post by Zhiyu (Drew) Li
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
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+***@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/CAFwN1uqEeB%2BmdUQ8DYbUFfdRBCqr7Bv5R_2GqT9mb53buovdBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Zhiyu/Drew Li
2018-11-09 21:11:21 UTC
Permalink
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"),
])
Post by Andrew Godwin
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
Post by Zhiyu (Drew) Li
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
<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+***@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/1f880fe4-2eab-4a41-bcce-f36f3bc77772%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...