Get the view function for running PyWebIO applications in Django. The view communicates with the browser by HTTP protocol. The arguments of ``webio_view()`` have the same meaning as for :func:`pywebio.platform.flask.webio_view`
(applications, cdn=True,
session_expire_seconds=None,
session_cleanup_interval=None,
allowed_origins=None, check_origin=None)
| 73 | |
| 74 | |
| 75 | def webio_view(applications, cdn=True, |
| 76 | session_expire_seconds=None, |
| 77 | session_cleanup_interval=None, |
| 78 | allowed_origins=None, check_origin=None): |
| 79 | """Get the view function for running PyWebIO applications in Django. |
| 80 | The view communicates with the browser by HTTP protocol. |
| 81 | |
| 82 | The arguments of ``webio_view()`` have the same meaning as for :func:`pywebio.platform.flask.webio_view` |
| 83 | """ |
| 84 | cdn = cdn_validation(cdn, 'error') |
| 85 | handler = HttpHandler(applications=applications, cdn=cdn, |
| 86 | session_expire_seconds=session_expire_seconds, |
| 87 | session_cleanup_interval=session_cleanup_interval, |
| 88 | allowed_origins=allowed_origins, check_origin=check_origin) |
| 89 | |
| 90 | from django.views.decorators.csrf import csrf_exempt |
| 91 | |
| 92 | @csrf_exempt |
| 93 | def view_func(request): |
| 94 | context = DjangoHttpContext(request) |
| 95 | return handler.handle_request(context) |
| 96 | |
| 97 | view_func.__name__ = 'webio_view' |
| 98 | return view_func |
| 99 | |
| 100 | |
| 101 | urlpatterns = [] |
no test coverage detected
searching dependent graphs…