python - More elegant way to ignore static urls in Middleware in Django? -


middleware-wizards,

i wondering if there more elegant way find out whether request serves 1 of custom view methods or rather static content etc. instead?

class mymiddleware(object):     def process_view(self, request, view_func, view_args, view_kwargs):         if view_func.__name__ != 'serve':             # here         return none 

if serving static files via static_url can check request.path. (process_request)

def process_request(request):     if request.path.startswith(settings.static_url):         # here 

anyway that's applicable during development cause apache or nginx or cdn serving static files , requests never hit django app.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -