__init__.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. r"""
  2. The ``platform`` module provides support for different web frameworks.
  3. See also: :ref:`Integration with Web Framework <integration_web_framework>` section of user manual.
  4. .. versionchanged:: 1.1
  5. Added the ``cdn`` parameter in ``start_server``, ``webio_handler`` and ``webio_view``.
  6. .. versionchanged:: 1.2
  7. Added the ``static_dir`` parameter in ``start_server``.
  8. Tornado support
  9. -----------------
  10. There are two protocols (WebSocket and HTTP) can be used to communicates with the browser:
  11. WebSocket
  12. ^^^^^^^^^^^
  13. .. autofunction:: pywebio.platform.tornado.start_server
  14. .. autofunction:: pywebio.platform.tornado.webio_handler
  15. HTTP
  16. ^^^^^^^^^^^
  17. .. autofunction:: pywebio.platform.tornado_http.start_server
  18. .. autofunction:: pywebio.platform.tornado_http.webio_handler
  19. Flask support
  20. -----------------
  21. When using the Flask as PyWebIO backend server, you need to install Flask by yourself and make sure the version is not less than ``0.10``.
  22. You can install it with the following command::
  23. pip3 install -U flask>=0.10
  24. .. autofunction:: pywebio.platform.flask.webio_view
  25. .. autofunction:: pywebio.platform.flask.start_server
  26. Django support
  27. -----------------
  28. When using the Django as PyWebIO backend server, you need to install Django by yourself and make sure the version is not less than ``2.2``.
  29. You can install it with the following command::
  30. pip3 install -U django>=2.2
  31. .. autofunction:: pywebio.platform.django.webio_view
  32. .. autofunction:: pywebio.platform.django.start_server
  33. aiohttp support
  34. -----------------
  35. When using the aiohttp as PyWebIO backend server, you need to install aiohttp by yourself and make sure the version is not less than ``3.1``.
  36. You can install it with the following command::
  37. pip3 install -U aiohttp>=3.1
  38. .. autofunction:: pywebio.platform.aiohttp.webio_handler
  39. .. autofunction:: pywebio.platform.aiohttp.start_server
  40. Other
  41. --------------
  42. .. autofunction:: pywebio.platform.seo
  43. .. autofunction:: pywebio.platform.run_event_loop
  44. """
  45. from .httpbased import run_event_loop
  46. from .tornado import start_server
  47. from .utils import seo