Discussion:
Adding Channels to and Existing Django Application
j***@brickabode.com
2018-11-04 21:04:57 UTC
Permalink
Greetings y'all!

I'm looking for recommendations regarding adding Channels to an existing
Django 1.11 application.

Every guide I've followed assumes that one is using Channels to build an
application from scratch, and that is OK to replace django's native calls
by Channels.

Channels' documentation suggests different ways of setting up
authentication, sessions, etc, but it is not clear to me that every feature
of Django 1.11 has its counterpart
on Channels. I am afraid I'll spend days migrating my system to Channels
only to figure out that a particular feature of Django is not supported by
Channels. In order to avoid that I've decided to ask y'all first.

Ideally, I would like to set Channels on a particular Django app, not on
the entire Django project (other apps would not be aware of Channels being
setup). Is that possible?

If this is not possible, my best guess is that I would need to add Channels
to an independent Django project, and have these two servers communicate.
This 2nd server would point to the same database as the 1st, and thus would
be able to run authentication with same credentials, among other data
related operations.

I appreciate any guidance on this matter.
--
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/a8c4164a-ffbb-4975-8d48-f8f058466b4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrew Godwin
2018-11-05 23:23:50 UTC
Permalink
Hey,

You can just add channels to an existing Django project and only use it for
the bits you need it for - even down to running two different servers for
that project, one normal WSGI one and one ASGI one to let you do async
things.

You shouldn't migrate any existing code to channels - just add it and then
use it for the new bits you need it for, basically.

Andrew
Post by j***@brickabode.com
Greetings y'all!
I'm looking for recommendations regarding adding Channels to an existing
Django 1.11 application.
Every guide I've followed assumes that one is using Channels to build an
application from scratch, and that is OK to replace django's native calls
by Channels.
Channels' documentation suggests different ways of setting up
authentication, sessions, etc, but it is not clear to me that every feature
of Django 1.11 has its counterpart
on Channels. I am afraid I'll spend days migrating my system to Channels
only to figure out that a particular feature of Django is not supported by
Channels. In order to avoid that I've decided to ask y'all first.
Ideally, I would like to set Channels on a particular Django app, not on
the entire Django project (other apps would not be aware of Channels being
setup). Is that possible?
If this is not possible, my best guess is that I would need to add
Channels to an independent Django project, and have these two servers
communicate. This 2nd server would point to the same database as the 1st,
and thus would be able to run authentication with same credentials, among
other data related operations.
I appreciate any guidance on this matter.
--
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/a8c4164a-ffbb-4975-8d48-f8f058466b4d%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/a8c4164a-ffbb-4975-8d48-f8f058466b4d%40googlegroups.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/CAFwN1uprrm2fVuC6mpX6OdHWPb55S1v%3DT%2BJP8vss_%3Dz1_p2DMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
j***@brickabode.com
2018-11-06 13:31:19 UTC
Permalink
even down to running two different servers for that project, one normal
WSGI one and one ASGI one to let you do async things.
I've tried doing that, but failed. I've created a asgi.py file and tried to
run it with daphne, but the server didn't start. Daphne simply hang there.
To my surprise, the same asgi.py file works fine on a completely
independent django project. My best guess is that something on the
convoluted settings.py is messing up with daphne.

Are you aware of a project that does what you've mentioned? Would you point
me to it? I think that looking at the config files could help me set this
up.

Juarez
Hey,
You can just add channels to an existing Django project and only use it
for the bits you need it for - even down to running two different servers
for that project, one normal WSGI one and one ASGI one to let you do async
things.
You shouldn't migrate any existing code to channels - just add it and then
use it for the new bits you need it for, basically.
Andrew
Post by j***@brickabode.com
Greetings y'all!
I'm looking for recommendations regarding adding Channels to an existing
Django 1.11 application.
Every guide I've followed assumes that one is using Channels to build an
application from scratch, and that is OK to replace django's native calls
by Channels.
Channels' documentation suggests different ways of setting up
authentication, sessions, etc, but it is not clear to me that every feature
of Django 1.11 has its counterpart
on Channels. I am afraid I'll spend days migrating my system to Channels
only to figure out that a particular feature of Django is not supported by
Channels. In order to avoid that I've decided to ask y'all first.
Ideally, I would like to set Channels on a particular Django app, not on
the entire Django project (other apps would not be aware of Channels being
setup). Is that possible?
If this is not possible, my best guess is that I would need to add
Channels to an independent Django project, and have these two servers
communicate. This 2nd server would point to the same database as the 1st,
and thus would be able to run authentication with same credentials, among
other data related operations.
I appreciate any guidance on this matter.
--
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/a8c4164a-ffbb-4975-8d48-f8f058466b4d%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/a8c4164a-ffbb-4975-8d48-f8f058466b4d%40googlegroups.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/5cba75bd-19cc-4a10-97bc-e85ffc51cca3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrew Godwin
2018-11-06 16:48:36 UTC
Permalink
I'm afraid I don't have an easy example to hand - maybe someone else does.
It sounds like you might have something odd in your settings, models.py, or
other files that load at startup.

Andrew
even down to running two different servers for that project, one normal
WSGI one and one ASGI one to let you do async things.
I've tried doing that, but failed. I've created a asgi.py file and tried
to run it with daphne, but the server didn't start. Daphne simply hang
there. To my surprise, the same asgi.py file works fine on a completely
independent django project. My best guess is that something on the
convoluted settings.py is messing up with daphne.
Are you aware of a project that does what you've mentioned? Would you
point me to it? I think that looking at the config files could help me set
this up.
Juarez
Hey,
You can just add channels to an existing Django project and only use it
for the bits you need it for - even down to running two different servers
for that project, one normal WSGI one and one ASGI one to let you do async
things.
You shouldn't migrate any existing code to channels - just add it and
then use it for the new bits you need it for, basically.
Andrew
Post by j***@brickabode.com
Greetings y'all!
I'm looking for recommendations regarding adding Channels to an existing
Django 1.11 application.
Every guide I've followed assumes that one is using Channels to build an
application from scratch, and that is OK to replace django's native calls
by Channels.
Channels' documentation suggests different ways of setting up
authentication, sessions, etc, but it is not clear to me that every feature
of Django 1.11 has its counterpart
on Channels. I am afraid I'll spend days migrating my system to Channels
only to figure out that a particular feature of Django is not supported by
Channels. In order to avoid that I've decided to ask y'all first.
Ideally, I would like to set Channels on a particular Django app, not on
the entire Django project (other apps would not be aware of Channels being
setup). Is that possible?
If this is not possible, my best guess is that I would need to add
Channels to an independent Django project, and have these two servers
communicate. This 2nd server would point to the same database as the 1st,
and thus would be able to run authentication with same credentials, among
other data related operations.
I appreciate any guidance on this matter.
--
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
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/a8c4164a-ffbb-4975-8d48-f8f058466b4d%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/a8c4164a-ffbb-4975-8d48-f8f058466b4d%40googlegroups.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
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/5cba75bd-19cc-4a10-97bc-e85ffc51cca3%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/5cba75bd-19cc-4a10-97bc-e85ffc51cca3%40googlegroups.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/CAFwN1uqjQzKmzDoHhXE-M5a1B-XuJ7tRhpjhvJr%2Bf056Lck9DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...