Can login_required by applied to an entire app?

django

Solution

Yes, you should use middleware.

Try to look through solutions which have some differences:

- http://www.djangosnippets.org/snippets/1179/ - with list of exceptions.

- http://www.djangosnippets.org/snippets/1158/ - with list of exceptions.

- http://www.djangosnippets.org/snippets/966/ - conversely with list of login required urls.

- http://www.djangosnippets.org/snippets/136/ - simplest.

Problem

Is there a way I can apply the `login_required` decorator to an entire app? When I say "app" I mean it in the django sense, which is to say a set of urls and views, not an entire project.

Original source