prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Django autoload_handle broken
  #### ALL software version info
  Panel =  0.13.0a25
  Bokeh  = 2.4.2
  Django = 2.2.14
  
  When loading a Panel app embedded in Django, the `AutoloadJsConsumer` call just hangs. After stepping through the code it 
  appears there is an error, which causes it to enter an eternal loop:
  
  ```python
  > /Users/rditlsc9/miniconda/envs/tethys-vtime/lib/python3.7/site-packages/panel/io/django.py(37)autoload_handle()
  -> js = autoload_js_script(resources, session.token, element_id, app_path, absolute_url)
  
  TypeError: autoload_js_script() missing 1 required positional argument: 'absolute_url'
  ```
  
  It appears that #2919 changed the signature of `autoload_js_script`, but the call to it in `panel/io/django.py:autoload_handle` wasn't updated accordingly.
  
  
  As a side note - is there a better way to get this type of error to log? I wasn't able to see any indication of an error until I stepped through the code in a debugger.
  
  
  </issue>
  <code>
  [start of panel/io/django.py]
  1 from urllib.parse import urlparse
  2 
  3 from bokeh.server.django.consumers import DocConsumer, AutoloadJsConsumer
  4 
  5 from .resources import Resources
  6 from .server import (
  7     autoload_js_script, server_html_page_for_session
  8 )
  9 
  10 async def doc_handle(self, body):
  11     session = await self._get_session()
  12     resources = Resources.from_bokeh(self.application.resources())
  13     page = server_html_page_for_session(
  14         session, resources=resources, title=session.document.title,
  15         template=session.document.template,
  16         template_variables=session.document.template_variables
  17     )
  18     await self.send_response(200, page.encode(), headers=[(b"Content-Type", b"text/html")])
  19 
  20 
  21 async def autoload_handle(self, body):
  22     session = await self._get_session()
  23 
  24     element_id = self.get_argument("bokeh-autoload-element", default=None)
  25     if not element_id:
  26         raise RuntimeError("No bokeh-autoload-element query parameter")
  27 
  28     app_path = self.get_argument("bokeh-app-path", default="/")
  29     absolute_url = self.get_argument("bokeh-absolute-url", default=None)
  30 
  31     if absolute_url:
  32         server_url = '{uri.scheme}://{uri.netloc}/'.format(uri=urlparse(absolute_url))
  33     else:
  34         server_url = None
  35 
  36     resources = self.resources(server_url)
  37     js = autoload_js_script(resources, session.token, element_id, app_path, absolute_url)
  38 
  39     headers = [
  40         (b"Access-Control-Allow-Headers", b"*"),
  41         (b"Access-Control-Allow-Methods", b"PUT, GET, OPTIONS"),
  42         (b"Access-Control-Allow-Origin", b"*"),
  43         (b"Content-Type", b"application/javascript")
  44     ]
  45     await self.send_response(200, js.encode(), headers=headers)
  46 
  47 
  48 DocConsumer.handle = doc_handle
  49 AutoloadJsConsumer.handle = autoload_handle
  50
  [end of panel/io/django.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/panel/io/django.py b/panel/io/django.py
  --- a/panel/io/django.py
  +++ b/panel/io/django.py
  @@ -34,7 +34,7 @@
           server_url = None
   
       resources = self.resources(server_url)
  -    js = autoload_js_script(resources, session.token, element_id, app_path, absolute_url)
  +    js = autoload_js_script(session.document, resources, session.token, element_id, app_path, absolute_url)
   
       headers = [
           (b"Access-Control-Allow-Headers", b"*"),
  
verification_info: {"golden_diff": "diff --git a/panel/io/django.py b/panel/io/django.py\n--- a/panel/io/django.py\n+++ b/panel/io/django.py\n@@ -34,7 +34,7 @@\n         server_url = None\n \n     resources = self.resources(server_url)\n-    js = autoload_js_script(resources, session.token, element_id, app_path, absolute_url)\n+    js = autoload_js_script(session.document, resources, session.token, element_id, app_path, absolute_url)\n \n     headers = [\n         (b\"Access-Control-Allow-Headers\", b\"*\"),\n", "issue": "Django autoload_handle broken\n#### ALL software version info\r\nPanel =  0.13.0a25\r\nBokeh  = 2.4.2\r\nDjango = 2.2.14\r\n\r\nWhen loading a Panel app embedded in Django, the `AutoloadJsConsumer` call just hangs. After stepping through the code it \r\nappears there is an error, which causes it to enter an eternal loop:\r\n\r\n```python\r\n> /Users/rditlsc9/miniconda/envs/tethys-vtime/lib/python3.7/site-packages/panel/io/django.py(37)autoload_handle()\r\n-> js = autoload_js_script(resources, session.token, element_id, app_path, absolute_url)\r\n\r\nTypeError: autoload_js_script() missing 1 required positional argument: 'absolute_url'\r\n```\r\n\r\nIt appears that #2919 changed the signature of `autoload_js_script`, but the call to it in `panel/io/django.py:autoload_handle` wasn't updated accordingly.\r\n\r\n\r\nAs a side note - is there a better way to get this type of error to log? I wasn't able to see any indication of an error until I stepped through the code in a debugger.\r\n\n", "before_files": [{"content": "from urllib.parse import urlparse\n\nfrom bokeh.server.django.consumers import DocConsumer, AutoloadJsConsumer\n\nfrom .resources import Resources\nfrom .server import (\n    autoload_js_script, server_html_page_for_session\n)\n\nasync def doc_handle(self, body):\n    session = await self._get_session()\n    resources = Resources.from_bokeh(self.application.resources())\n    page = server_html_page_for_session(\n        session, resources=resources, title=session.document.title,\n        template=session.document.template,\n        template_variables=session.document.template_variables\n    )\n    await self.send_response(200, page.encode(), headers=[(b\"Content-Type\", b\"text/html\")])\n\n\nasync def autoload_handle(self, body):\n    session = await self._get_session()\n\n    element_id = self.get_argument(\"bokeh-autoload-element\", default=None)\n    if not element_id:\n        raise RuntimeError(\"No bokeh-autoload-element query parameter\")\n\n    app_path = self.get_argument(\"bokeh-app-path\", default=\"/\")\n    absolute_url = self.get_argument(\"bokeh-absolute-url\", default=None)\n\n    if absolute_url:\n        server_url = '{uri.scheme}://{uri.netloc}/'.format(uri=urlparse(absolute_url))\n    else:\n        server_url = None\n\n    resources = self.resources(server_url)\n    js = autoload_js_script(resources, session.token, element_id, app_path, absolute_url)\n\n    headers = [\n        (b\"Access-Control-Allow-Headers\", b\"*\"),\n        (b\"Access-Control-Allow-Methods\", b\"PUT, GET, OPTIONS\"),\n        (b\"Access-Control-Allow-Origin\", b\"*\"),\n        (b\"Content-Type\", b\"application/javascript\")\n    ]\n    await self.send_response(200, js.encode(), headers=headers)\n\n\nDocConsumer.handle = doc_handle\nAutoloadJsConsumer.handle = autoload_handle\n", "path": "panel/io/django.py"}]}