def sub_folder_available(request):
    folder = convert_url_path_to_folder_path(request.path)
return {'subsection': folder, 'local_base': folder + '/base.html'}
Django: specifying a base template by directory