Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login- logout @urls.py #13

Closed
yusufhilmi opened this issue Feb 11, 2020 · 3 comments
Closed

login- logout @urls.py #13

yusufhilmi opened this issue Feb 11, 2020 · 3 comments

Comments

@yusufhilmi
Copy link

yusufhilmi commented Feb 11, 2020

Firstly I am kinda new for django so it might be an easy issue,

I was taking an error at ./chat/urls.py

path('login/', auth_views.login, name='login'), path('logout/', auth_views.logout, {'next_page': '/'}, name='logout', )

I have fixed this with replacing it with
path('login/', auth_views.LoginView, name='login'), path('logout/', auth_views.LogoutView, {'next_page': '/'}, name='logout', )

but an error rises when I try to login with url http://127.0.0.1:8000/ which redirects to http://127.0.0.1:8000/login/?next=/

I have this error in Debug
`

Django Version: 2.2.8
Python Version: 3.6.5
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'core',
'rest_framework',
'channels']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback:

File "C:\Users\ASUS.virtualenvs\django-channels-chat-master-uWlQjTPL\lib\site-packages\django\core\handlers\exception.py" in inner
34. response = get_response(request)

File "C:\Users\ASUS.virtualenvs\django-channels-chat-master-uWlQjTPL\lib\site-packages\django\core\handlers\base.py" in _get_response
115. response = self.process_exception_by_middleware(e, request)

File "C:\Users\ASUS.virtualenvs\django-channels-chat-master-uWlQjTPL\lib\site-packages\django\core\handlers\base.py" in _get_response
113. response = wrapped_callback(request, *callback_args, **callback_kwargs)

Exception Type: TypeError at /login/
Exception Value: init() takes 1 positional argument but 2 were given
`

I know that the AUTH is still in TO-DO list but if I can understand this I think I might help to develop this project further

@yusufhilmi
Copy link
Author

yusufhilmi commented Feb 14, 2020

solved the issue
path('login/', auth_views.LoginView.as_view(), name='login'), path('logout/', auth_views.LogoutView.as_view(), {'next_page': '/'}, name='logout', )
this part should be fixed by adding " .as_view " after describing view type

@yusufhilmi
Copy link
Author

Should I make a pull request?

@yusufhilmi yusufhilmi reopened this Feb 14, 2020
narrowfail added a commit that referenced this issue Feb 14, 2020
@narrowfail
Copy link
Owner

Good catch! I solved the issue on my last commit! Thanks @yusufhilmi !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants