#30344: Converted serve static to class base views
-------------------------------------+-------------------------------------
     Reporter:  Tom Turner           |                    Owner:  nobody
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  contrib.staticfiles  |                  Version:  master
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

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>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.0e3723b6754d3c1473bad384c082a661%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to