Websocket support (django channels)
See original GitHub issueIs it possible to configure behave-django to test django apps with channels integrated?
For WSGI there is wsgiref used right in the documentation:
import threading
from wsgiref import simple_server
from selenium import webdriver
from my_application import model
from my_application import web_app
def before_all(context):
context.server = simple_server.WSGIServer(('', 8000))
context.server.set_app(web_app.main(environment='test’))
context.thread = threading.Thread(target=context.server.serve_forever) context.thread.start()
context.browser = webdriver.Chrome()
However Django channels is using ASGI and daphne: http://channels.readthedocs.io/en/latest/asgi.html
Currently I’m deploying my app (for debugging) by:
$ venv/bin/daphne <app>.asgi:channel_layer --port 80 --bind 0.0.0.0 -v2
$ venv/bin/python manage.py runworker --settings=<app>.settings -v2
How can I configure behave-django to use daphne (and use runworker…)
I tried to set “context.server” in “before_all”, googled a lot but I still can’t figure it out.
Should I override DjangoBehaveTestSuiteRunner and if so, how?
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (10 by maintainers)
Top Results From Across the Web
Django Channels and WebSockets - LogRocket Blog
Django Channels facilitates support of WebSockets in Django in a manner similar to traditional HTTP views. It wraps Django's native ...
Read more >Django Channels — Channels 4.0.0 documentation
Channels is a project that takes Django and extends its abilities beyond HTTP - to handle WebSockets, chat protocols, IoT protocols, and more....
Read more >Getting Started with Django Channels - Real Python
With WebSockets (via Django Channels) managing the communication between the client and the server, whenever a user is authenticated, an event will be ......
Read more >A Beginners Guide to WebSockets in Django - Medium
pip install channels==2.1.2 · INSTALLED_APPS = [ 'django. · python manage.py migrate. Now if you guys were to run · python manage.py runserver....
Read more >Django Websockets: A Complete Beginners Guide! - eSketchers
Websockets using Django Channels ... Django 2.0 or above comes with asynchronous support. It has full support to create WebSockets connections and ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry @UrAvgProgrammer but I haven’t looked at Channels since early 2017 when we decided to drop channels and move to a polling solution based on vanilla Django.
Hello all, @proofit404 has contributed a significant amount of work for a
ChannelLiveServerTestCase
in https://github.com/django/channels/pull/497. 🥇Please clone the changes, try the code, and give feedback! As soon as we have confirmed that this works as needed it’s probably going to be merged into django/channel master. Hurry! 🚀 Thank you.