-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing support for --nostatic and --insecure options in Daphne's runserver command #449
Comments
Ok, yes, this would be a reasonable addition. Would you like to make a PR? Thanks. |
PR available at #450 waiting for approval. |
I just pip installed the lastest stable version of
|
Okay I see the PR was never merged, maybe we can reopen the issue, because 2 years later it still has not been resolved? |
carltongibson
pushed a commit
that referenced
this issue
Jan 4, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The django.contrib.staticfiles app includes a custom runserver command that shadows the default runserver command from Django in order to provide a way of easily serving static files, normally in a dev env.
Daphne's own runserver command is supposed to shadow django.contrib.staticfiles' command as well, if present, and provide all the extra bits and pieces in order to support Django Channels. Serving of static files is still done by leveraging django.contrib.staticfiles'
ASGIStaticFilesHandler
class, so we could say that, in this particular matter, Daphne is working as a kind of wrapper for django.contrib.staticfiles' functionality. And yet, there are two command arguments (--nostatic
and--insecure
) that can be passed to django.contrib.staticfiles' runserver that cannot be passed to Daphne's because it doesn't recognize them.Strangely enough, code at Daphne's command seems to be already prepared to take into account such two configuration options (usages of
use_static_handler
andinsecure_serving
options at https://github.com/django/daphne/blob/main/daphne/management/commands/runserver.py#L150 to respectively prevent or force the serving of static files if required to do so), but the command arguments to populate those options are missing.Is it possible that defining these two command arguments in the runserver command's
add_arguments()
function was somehow forgotten? Or given the similarities in the naming of such options and in the way they're being used, that exactly matches the code at django.contrib.staticfiles' command (https://github.com/django/django/blob/main/django/contrib/staticfiles/management/commands/runserver.py#L32), could it be that there was a plan to make Daphne's command extend the one from django.contrib.staticfiles, that defines those two arguments, but ended up extending Django core's runserver command instead, thus missing the arguments definition?We need the ability to avoid serving static files through django.contrib.staticfiles in our dev env because we handle that traffic by other means, and this has been proven problematic when using Daphne.
Thank you.
The text was updated successfully, but these errors were encountered: