1
0

misc.rst 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. Miscellaneous
  2. ===============
  3. .. _codemirror_options:
  4. Commonly used Codemirror options
  5. ------------------------------------
  6. * ``mode`` (str): The language of code. For complete list, see https://codemirror.net/mode/index.html
  7. * ``theme`` (str): The theme to style the editor with. For all available theme, see https://codemirror.net/demo/theme.html
  8. * ``lineNumbers`` (bool): Whether to show line numbers to the left of the editor.
  9. * ``indentUnit`` (int): How many spaces a block (whatever that means in the edited language) should be indented. The default is 2.
  10. * ``tabSize`` (int): The width of a tab character. Defaults to 4.
  11. * ``lineWrapping`` (bool): Whether CodeMirror should scroll or wrap for long lines. Defaults to false (scroll).
  12. For complete Codemirror options, please visit: https://codemirror.net/doc/manual.html#config
  13. .. _nginx_ws_config:
  14. Nginx WebSocket Config Example
  15. ---------------------------------
  16. Assuming that the PyWebIO application is running at the ``localhost:5000`` address, if you want to access your PyWebIO application via ``http://server_ip/some_path/tool``, a sample Nginx configuration is as follows::
  17. map $http_upgrade $connection_upgrade {
  18. default upgrade;
  19. '' close;
  20. }
  21. server {
  22. listen 80;
  23. location /some_path/ {
  24. alias /path/to/pywebio/static/dir/;
  25. }
  26. location /some_path/tool {
  27. proxy_read_timeout 300s;
  28. proxy_send_timeout 300s;
  29. proxy_http_version 1.1;
  30. proxy_set_header Host $http_host;
  31. proxy_set_header Upgrade $http_upgrade;
  32. proxy_set_header Connection $connection_upgrade;
  33. proxy_pass http://localhost:5000/;
  34. }
  35. }
  36. The above configuration file hosts the static files of PyWebIO on the ``/some_path/`` path, and reverse proxy ``/some_path/tool`` to ``localhost:5000``.
  37. The path of the static file of PyWebIO can be obtained with the command ``python3 -c "import pywebio; print(pywebio.STATIC_PATH)"``, you can also copy the static file to other directories::
  38. cp -r `python3 -c "import pywebio; print(pywebio.STATIC_PATH)"` ~/web