[Answer]-Django: a custom view inside /static/ directory

1👍

You’re using ./manage.py runserver on your dev server, right? Then you can go this way: ./manage.py runserver --nostatic, and in urls.py:

from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns = patterns('',
    url(r'^static/blueprints/(?P<blueprint>[\w-]+)/(?P<path>.+)', 'my_view_name'),
    ...
)
if settings.DEBUG:
    urlpatterns += staticfiles_urlpatterns()
👤ZZY

Leave a comment