Trying to get the static file to route through daphne. I've tried using the default 'AsgiHandler' and tried both 'StaticFilesHandler' and 'StaticFilesWrapper'. Here's my settings.py, routing.py setup and output:
from django.conf.urls import url
from channels.http import AsgiHandler
from channels.routing import ProtocolTypeRouter, URLRouter
application = ProtocolTypeRouter({
# Channels will do this for you automatically. It's included here as an example.
"http": URLRouter([
# AsgiHandler is "the rest of Django" - send things here to have Django
# views handle them.
url(r"^", AsgiHandler),
]),
})
----------------------------------
from django.conf.urls import url
from channels.staticfiles import StaticFilesHandler
from channels.routing import ProtocolTypeRouter, URLRouter
application = ProtocolTypeRouter({
# Channels will do this for you automatically. It's included here as an example.
"http": URLRouter([
# AsgiHandler is "the rest of Django" - send things here to have Django
# views handle them.
url(r"^", StaticFilesHandler),
]),
})
2019-01-31 10:31:57,386 ERROR Exception inside application: 'static_base_url'
File "c:\python37\lib\site-packages\channels\http.py", line 202, in __call__
await self.handle(body)
File "c:\python37\lib\site-packages\asgiref\sync.py", line 108, in __call__
return await asyncio.wait_for(future, timeout=None)
File "C:\Python37\Lib\asyncio\tasks.py", line 388, in wait_for
return await fut
File "C:\Python37\Lib\concurrent\futures\thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "c:\python37\lib\site-packages\asgiref\sync.py", line 123, in thread_handler
return self.func(*args, **kwargs)
File "c:\python37\lib\site-packages\channels\http.py", line 233, in handle
response = self.get_response(request)
File "c:\python37\lib\site-packages\channels\staticfiles.py", line 68, in get_response
return self.serve(request)
File "c:\python37\lib\site-packages\channels\staticfiles.py", line 60, in serve
return serve(request, self.file_path(request.path), insecure=True)
File "c:\python37\lib\site-packages\channels\staticfiles.py", line 53, in file_path
relative_url = url[len(self.scope["static_base_url"][2]) :]
'static_base_url'
---------------------------------------------
from django.conf.urls import url
from channels.staticfiles import StaticFilesWrapper
from channels.routing import ProtocolTypeRouter, URLRouter
application = ProtocolTypeRouter({
# Channels will do this for you automatically. It's included here as an example.
"http": URLRouter([
# AsgiHandler is "the rest of Django" - send things here to have Django
# views handle them.
url(r"^", StaticFilesWrapper),
]),
})
2019-01-31 10:36:28,617 ERROR Traceback (most recent call last):
File "c:\python37\lib\site-packages\daphne\http_protocol.py", line 179, in process
"server": self.server_addr,
TypeError: __call__() got an unexpected keyword argument 'receive'