☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Uwsgi+django+bokeh

Community Supportserver
LaurentBerger
LaurentBerger

Hi I have got same problem :

[26/Mar/2021 15:25:53] "GET /index/sea_surface HTTP/1.1" 200 769
Not Found: /index/sea_surface/autoload.js
[26/Mar/2021 15:25:53] "GET /index/sea_surface/autoload.js?bokeh-autoload-element=1075&bokeh-app-path=/index/sea_surface&bokeh-absolute-url=http://127.0.0.1:8000/index/sea_surface HTTP/1.1" 404 5284

Did you solve this problem?

Django is in debug mode and I printed some variables
example

def sea_surface(request: HttpRequest) -> HttpResponse:
     script = server_document(request.build_absolute_uri())
    print(script)
    return render(request, "embed.html", dict(script=script))

I get

< script id="1075" >
var xhr = new XMLHttpRequest()
xhr.responseType = 'blob';
xhr.open('GET', "http://127.0.0.1:8000/index/sea_surface/autoload.js?bokeh-autoload-element=1075&bokeh-app-path=/index/sea_surface&bokeh-absolute-url=http://127.0.0.1:8000/index/sea_surface", true);

  xhr.onload = function (event) {
    var script = document.createElement('script'),
    src = URL.createObjectURL(event.target.response);
    script.src = src;
    document.body.appendChild(script);
  };
xhr.send();
</script>

and http://127.0.0.1:8000/index/sea_surface page is

<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Embedding a Bokeh Apps In Django via autoload.js</title>
</head>

<body>
  <div>
    This Bokeh app below is served by a Django server (via autoload.js):
  </div>
  
<script id="1075">
  var xhr = new XMLHttpRequest()
  xhr.responseType = 'blob';
  xhr.open('GET', "http://127.0.0.1:8000/index/sea_surface/autoload.js?bokeh-autoload-element=1075&bokeh-app-path=/index/sea_surface&bokeh-absolute-url=http://127.0.0.1:8000/index/sea_surface", true);
  
  xhr.onload = function (event) {
    var script = document.createElement('script'),
    src = URL.createObjectURL(event.target.response);
    script.src = src;
    document.body.appendChild(script);
  };
xhr.send();
</script>
</body>
</html>

What’s wrong?

⌁   Link to post
LaurentBerger
LaurentBerger

Thanks for you answer. Minimal example with django :thinking:
Now I put my code in trash and start again from bokeh/examples/howto/server_embed/django_embed/django_embed at a4a807585f1b02ad213c643bf0fda6081ae4170b · bokeh/bokeh · GitHub
My code is here
It does not work but there is a warning

Watching for file changes with StatReloader
Performing system checks...

<DjangoBokehConfig: bokeh.server.django>
WARNING:bokeh.server.django.routing:bokeh applications directory 'F:\Program Files\Python\lib\site-packages\app' doesn't exist
System check identified no issues (0 silenced).
March 26, 2021 - 19:36:29
Django version 3.1, using settings 'traimaocv.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[26/Mar/2021 19:37:37] "GET /index/my_sea_surface HTTP/1.1" 200 751
Not Found: /sea_surface/autoload.js
[26/Mar/2021 19:37:37] "GET /sea_surface/autoload.js?bokeh-autoload-element=1074&bokeh-app-path=/sea_surface&bokeh-absolute-url=http://127.0.0.1:8000/sea_surface HTTP/1.1" 404 5519

investigating

⌁   Link to post
LaurentBerger
LaurentBerger

I tried GitHub - macwis/djpanel: Django + Panel + Bokeh (boilerplate). There is a problem with asgi configuration :

Django version 3.1, using settings 'djpanel.settings'
Starting ASGI/Channels version 3.0.3 development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Exception inside application: __init__() takes 1 positional argument but 2 were given
Traceback (most recent call last):
  File "F:\Program Files\Python\lib\site-packages\channels\staticfiles.py", line 44, in __call__
    return await self.application(scope, receive, send)
  File "F:\Program Files\Python\lib\site-packages\channels\routing.py", line 71, in __call__
    return await application(scope, receive, send)
  File "F:\Program Files\Python\lib\site-packages\channels\sessions.py", line 47, in __call__
    return await self.inner(dict(scope, cookies=cookies), receive, send)
  File "F:\Program Files\Python\lib\site-packages\channels\sessions.py", line 254, in __call__
    return await self.inner(wrapper.scope, receive, wrapper.send)
  File "F:\Program Files\Python\lib\site-packages\channels\auth.py", line 181, in __call__
    return await super().__call__(scope, receive, send)
  File "F:\Program Files\Python\lib\site-packages\channels\middleware.py", line 26, in __call__
    return await self.inner(scope, receive, send)
  File "F:\Program Files\Python\lib\site-packages\channels\routing.py", line 150, in __call__
    return await application(
  File "F:\Program Files\Python\lib\site-packages\asgiref\compatibility.py", line 33, in new_application
    instance = application(scope)
TypeError: __init__() takes 1 positional argument but 2 were given
HTTP GET /sliders 500 [0.33, 127.0.0.1:1337]
F:\django\djpanel-master\djpanel\settings.py changed, reloading.
Traceback (most recent call last):
  File "F:\django\djpanel-master\manage.py", line 21, in <module>
    main()
  File "F:\django\djpanel-master\manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "F:\Program Files\Python\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "F:\Program Files\Python\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "F:\Program Files\Python\lib\site-packages\django\core\management\__init__.py", line 244, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "F:\Program Files\Python\lib\site-packages\django\core\management\__init__.py", line 37, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "F:\Program Files\Python\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "F:\Program Files\Python\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 3, in <module>
    from django.core.management.commands.runserver import (
  File "F:\Program Files\Python\lib\site-packages\django\core\management\commands\runserver.py", line 10, in <module>
    from django.core.servers.basehttp import (
  File "F:\Program Files\Python\lib\site-packages\django\core\servers\basehttp.py", line 14, in <module>
    from wsgiref import simple_server
  File "F:\Program Files\Python\lib\wsgiref\simple_server.py", line 13, in <module>
    from http.server import BaseHTTPRequestHandler, HTTPServer
  File "F:\Program Files\Python\lib\http\server.py", line 628, in <module>
    class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
  File "F:\Program Files\Python\lib\http\server.py", line 880, in SimpleHTTPRequestHandler
    mimetypes.init() # try to read system mime.types
  File "F:\Program Files\Python\lib\mimetypes.py", line 353, in init
    db.read_windows_registry()
  File "F:\Program Files\Python\lib\mimetypes.py", line 259, in read_windows_registry
    with _winreg.OpenKey(hkcr, subkeyname) as subkey:

Now if I disabled asgi I can get same error :

Django version 3.1, using settings 'djpanel.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Not Found: /
[27/Mar/2021 19:18:23] "GET / HTTP/1.1" 404 2295
Not Found: /Sliders
[27/Mar/2021 19:18:41] "GET /Sliders HTTP/1.1" 404 2334
[27/Mar/2021 19:18:53] "GET /sliders HTTP/1.1" 301 0
[27/Mar/2021 19:18:53] "GET /sliders/ HTTP/1.1" 200 611
Not Found: /sliders/autoload.js
[27/Mar/2021 19:18:53] "GET /sliders/autoload.js?bokeh-autoload-element=1002&bokeh-app-path=/sliders&bokeh-absolute-url=http://127.0.0.1:8000/sliders HTTP/1.1" 404 2542

May be problem is in windows 10 implementation of asgi…

⌁   Link to post

End of archived discussion · Replies are disabled