Django's url dispatcher is based on regular expressions, so you can supply it with a regex that will match the path you wanted (with repeating groups).
However, I couldn't find a way to make django's url dispatcher match multiple sub-groups (it returns only the last match as a parameter), so some of the parameter processing is left for the view.
Here is an example url pattern:
urlpatterns = patterns('',
#...
(r'^(?P<foldersPath>(?:\w+/)+)(?P<action>\w+)', 'views.folder'),
)
In the first parameter we have a non-capturing group for repeating "word" characters followed by "/". Perhaps you'd want to change \w to something else to include other characters than alphabet and digits.
you can of course change it to multiple views in the url configuration instead of using the action param (which makes more sense if you have a limited set of actions):
urlpatterns = patterns('',
#...
(r'^(?P<foldersPath>(?:\w+/)+)view', 'views.folder_View'),
(r'^(?P<foldersPath>(?:\w+/)+)delete', 'views.folder_delete'),
)
and in the views, we split the first parameter to get an array of the folders:
def folder(request, foldersPath, action):
folders = foldersPath.split("/")[:-1]
print "folders:", folders, "action:", action
#...