Rewrite URL in Django 1.10

52 views Asked by At

Looking for how to convert this to Django 1.10:

('^plugins/(?P<path>.*)$', 'redirect_to', {'url': '/static/plugins/%(path)s'}),

Basically I have ~50 files in a HTML theme that reference files at /plugins/blah-blah and I want to serve via /static/plugins/blah-blah.

So any request to /plugins should go to /static/plugins - any idea how?

1

There are 1 answers

0
ruddra On

Probably you can look into RedirectView(django 1.10):

from django.views.generic.base import RedirectView

urlpatterns = [
    url(r'^plugins/(?P<pk>[0-9]+)/$', RedirectView.as_view(pattern_name='static-plugin'), name='plugins'),
    ...
]