Daphne raises Internal Server Error when accessing static files from development server

1,036 views
Skip to first unread message

kradem

unread,
Apr 6, 2021, 11:43:59 AM4/6/21
to Django users
> 500 Internal Server Error

> Exception inside application.

> Daphne

This error raises every time a file from static folder is accessed.

What would be a proper way for debugging this? I've got  "justMyCode": false setting in VS Code and that doesn't catch anything.

Python 3.9.2

channels                      3.0.3
daphne                        3.0.1
Django                        3.2

Andrew Godwin

unread,
Apr 6, 2021, 11:46:31 AM4/6/21
to django...@googlegroups.com
This may be related to https://github.com/django/asgiref/issues/251 - what version of asgiref are you running?

Andrew
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

kradem

unread,
Apr 6, 2021, 11:56:44 AM4/6/21
to Django users
Thank you very much for a quick response.

Yes, that's the problem:

asgiref                       3.3.2

When I downgrade it to 3.3.1 Django complains ("django 3.2 requires asgiref<4,>=3.3.2, but you have asgiref 3.3.1 which is incompatible."), but static files are served well.

I tried with the very last version 3.3.3 (-e git+https://github.com/django/asgiref.git#egg=asgiref), but problem hasn't been fixed that way.

kradem

unread,
Apr 6, 2021, 12:01:31 PM4/6/21
to Django users
Stop the press!! The 3.3.3 version is published in PyPi and after installing it it all works well! :)

Thank you!

Andrew Godwin

unread,
Apr 6, 2021, 12:02:52 PM4/6/21
to django...@googlegroups.com
asgiref 3.3.2 introduced stricter checks for what an async function is, so I would imagine that's the problem. 3.3.3 fixes some of them, but I'm guessing you might have a different flavour of problem.

Could you get the traceback out of Django that's causing the 500 error and post it here? 

Andrew

Andrew Godwin

unread,
Apr 6, 2021, 12:09:33 PM4/6/21
to django...@googlegroups.com
Aha, glad to hear it! My apologies that we didn't catch that one before release yesterday.

Andrew

kradem

unread,
Apr 6, 2021, 12:18:18 PM4/6/21
to Django users
I'm afraid a "success" was caused by the browser cache or something similar, the 3.3.3 version doesn't fix my problem. :(

> Could you get the traceback out of Django that's causing the 500 error and post it here? 

That was - kind of - my initial question, the only output I can get is the message from the first post and Django's output like:

HTTP GET /static/css/style.css 500 [0.35, 127.0.0.1:37982]
HTTP GET /static/js/jquery-2.2.4.min.js 500 [0.35, 127.0.0.1:37988]

Andrew Godwin

unread,
Apr 6, 2021, 12:26:34 PM4/6/21
to django...@googlegroups.com
The tracebacks are there somewhere, you might have to look at the raw HTTP response in the browser to see them.

Andrew

kradem

unread,
Apr 6, 2021, 2:19:15 PM4/6/21
to Django users
Not sure if I understand you, I'm getting an server error in my browser with rendered as quoted in the first post here with the following body:

 <html> <head> <title>500 Internal Server Error</title> <style>  body { font-family: sans-serif; margin: 0; padding: 0; }  h1 { padding: 0.6em 0 0.2em 20px; color: #896868; margin: 0; }  p { padding: 0 0 0.3em 20px; margin: 0; }  footer { padding: 1em 0 0.3em 20px; color: #999; font-size: 80%; font-style: italic; } </style> </head> <body> <h1>500 Internal Server Error</h1> <p>Exception inside application.</p> <footer>Daphne</footer> </body> </html> 

And as raw:

HTTP/1.1 500 Internal Server Error
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8

Andrew Godwin

unread,
Apr 6, 2021, 2:24:24 PM4/6/21
to django...@googlegroups.com
This is probably this error: https://github.com/django/asgiref/issues/251#issuecomment-814337170 - I'm going to switch the error to a warning and we'll see if that helps, then Daphne can have a fix added at a non-emergency pace.

Andrew

kradem

unread,
Apr 6, 2021, 5:05:44 PM4/6/21
to Django users
Yes, thank you very much, the error to warning switch in 3.3.4 solved the problem.

Best regards!

Reply all
Reply to author
Forward
0 new messages