pull request https://github.com/django/django/pull/11193
--
Ticket URL: <https://code.djangoproject.com/ticket/30344>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: Florian Apolloner (added)
* version: 2.2 => master
* component: Uncategorized => contrib.staticfiles
Comment:
What exactly couldn't you override/change? Changing views to functions
based views, just so they are a class is probably not enough. Also this
change is currently highly backwards incompatible.
--
Ticket URL: <https://code.djangoproject.com/ticket/30344#comment:1>
* status: new => closed
* resolution: => wontfix
* type: Uncategorized => Cleanup/optimization
Comment:
Agreed with Florian, just transforming to a class-based view without
making "entry-point" method to override for real use cases doesn't make
much sense. Maybe you could discuss that first on the django-developers
mailing list.
--
Ticket URL: <https://code.djangoproject.com/ticket/30344#comment:2>
Comment (by Tom Turner):
I agree it not backward compatible however that an easy fix more me to do
I wasn't going to do unless the ticket was accepted. I also agree the
patch needs some tidying up in regards to code comments
I will now give more details why I wanted this patch. I am the maintainer
of a project called Django Tenants http://github.com/tomturner/django-
tenants which allows you to have tenants in Django ie a.mydomain.com and
b.mydomain.com. The problem I have is that on the different domains I want
to serve different static files. The problem is I cant pick up the domain
and set the correct tenant. I believe this could do this easier if the
serve static is class based. Making the serve static class base will not
affect users of Django and I know a lot of other areas in Django have been
converted to class base views such as the admin
I believe one could override the entry point with something like this in
the url
{{{
re_path(r'^site_media/(?P<path>.*)$',
static.ServeStatic.as_view(document_root=media_dir, show_indexes=True))
}}}
I know server static should only be used for development use only.
Hopefully you now see the use case I want to do.
--
Ticket URL: <https://code.djangoproject.com/ticket/30344#comment:3>
Comment (by Florian Apolloner):
You are saying:
> The problem is I cant pick up the domain and set the correct tenant for
static files. I believe this could be done easier if the serve static is
class based.
I do not see how your changes would make this any easier, or why this
would not be possible with the current function based view.
--
Ticket URL: <https://code.djangoproject.com/ticket/30344#comment:4>