Skip to content
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

whitenoise.runserver_nostatic is ignored #4469

Closed
engAmirEng opened this issue Jul 18, 2023 · 5 comments
Closed

whitenoise.runserver_nostatic is ignored #4469

engAmirEng opened this issue Jul 18, 2023 · 5 comments
Labels

Comments

@engAmirEng
Copy link

What happened?

whitenoise.runserver_nostatic has no effect because of the order of INSTALLED_APPS, so the runserver command of staticfiles app is used instead of whitenoise.runserver_nostatic app

@engAmirEng engAmirEng added the bug label Jul 18, 2023
@browniebroke
Copy link
Member

So... what? How does it impact you? Why is it a bug? Please provide more details about what's expected and what actually happened.

@browniebroke browniebroke added the waiting Waiting for an answer and auto-close after 10 days label Jul 26, 2023
@engAmirEng
Copy link
Author

@browniebroke There is a package installed and added to project as Middleware and installed app but as it is now it has no use case, Django staticfiles run server is picked up instead of whitenoise's, how is this not a bug?

@github-actions github-actions bot removed the waiting Waiting for an answer and auto-close after 10 days label Jul 27, 2023
@browniebroke
Copy link
Member

browniebroke commented Jul 27, 2023

how is this not a bug?

I never said it wasn't: I asked for more details as I found your original message was a bit vague.

@browniebroke
Copy link
Member

browniebroke commented Jul 27, 2023

For context, this was added in #2304

I can't remeber how to identify which command is used. From what I can see in the Whitenoise docs, we seem to be doing what's needed, as the app is isntalled before django.contrib.staticfiles:

# WhiteNoise
# ------------------------------------------------------------------------------
# http://whitenoise.evans.io/en/latest/django.html#using-whitenoise-in-development
INSTALLED_APPS = ["whitenoise.runserver_nostatic"] + INSTALLED_APPS # noqa: F405
{% endif %}

I haven't tried to re-generate a project to try to reproduce. What options have you used?

PS: we have an issue template which asks which options were used, would have been nice to follow it (yes, it's actually useful).

@browniebroke
Copy link
Member

I cannot reproduce. When I run python manage.py runserver --help I can see the following output:

usage: manage.py runserver [-h] [--ipv6] [--nothreading] [--noreload] [--nostatic] [--insecure] [--version] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--no-color] [--force-color] [--skip-checks] [addrport]

Starts a lightweight web server for development and also serves static files. (Wrapped by 'whitenoise.runserver_nostatic' to always enable '--nostatic')
...

The part (Wrapped by 'whitenoise.runserver_nostatic' to always enable '--nostatic') indicates that the whitenoise command is used.

I'm closing this as I cannot reproduce. Please provide more details to reproduce the problem on a fresh project generated from this template: options used and steps demonstrating the issue, with expected vs actual behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants