I need to redirect user if logged in to his home page when he goes to main url.
urls.py

```
urlpatterns = [
    url(r'^$', LoginView.as_view(template_name='landing.html'), name='landing')
]

```

I tried creating custom view rather than using built in django login.

new urls.py

```
urlpatterns = [
    url(r'^$', landing_validation, name='landing')
]

```

views.py

```
def landing_validation(request):
  if request.user.is_authenticated:
    return HttpResponseRedirect('/user/home')
  else:
    return login(request)

```

This works good when user is logged in and tries to enter landing page it redirects him to home page i.e when user tries <http://127.0.0.1:8000> it redirects him to <http://127.0.0.1:8000/user/home/>. But when user logs out i get the error as follows
 `login() missing 1 required positional argument: 'user'`

I have set urls in settings.py as follows but have never used them:

```
LOGIN_REDIRECT_URL = '/user/home'

LOGIN_URL = '/'

```

Any insights on the issue are appreciated.

The logout is working perfectly fine and is as below.

Urls.py

```
  url(r'^logout/$',
      logoutUser,
    name='logout'
  ),

```

Views.py 

```
def logoutUser(request):
  logout(request)
  return HttpResponseRedirect('/')

```