You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "C:\Users\TarunMahajan\.virtualenvs\pracPy-b7vdO4P5\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
File "C:\Users\TarunMahajan\.virtualenvs\pracPy-b7vdO4P5\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\TarunMahajan\djangoProjects\pracPy\website\views.py", line 83, in register
return redirect('register')
File "C:\Users\TarunMahajan\.virtualenvs\pracPy-b7vdO4P5\lib\site-packages\django\shortcuts.py", line 48, in redirect
return redirect_class(resolve_url(to, *args, **kwargs))
File "C:\Users\TarunMahajan\.virtualenvs\pracPy-b7vdO4P5\lib\site-packages\django\shortcuts.py", line 145, in resolve_url
return reverse(to, args=args, kwargs=kwargs)
File "C:\Users\TarunMahajan\.virtualenvs\pracPy-b7vdO4P5\lib\site-packages\django\urls\base.py", line 88, in reverse
return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
File "C:\Users\TarunMahajan\.virtualenvs\pracPy-b7vdO4P5\lib\site-packages\django\urls\resolvers.py", line 803, in _reverse_with_prefix
raise NoReverseMatch(msg)
Exception Type: NoReverseMatch at /register
Exception Value: Reverse for 'register' not found. 'register' is not a valid view function or pattern name.
Here we can see register function is registered
Using the URLconf defined in tarunmahajan.urls, Django tried these URL patterns, in this order:
admin/
old
about
hello
register
The text was updated successfully, but these errors were encountered:
Well I used return render(request, 'register.html') instead of return redirect('register') so it's solved my problem temporary but I'm keep looking on it. Even after registering function properly in urls.py
Some interesting conversation I found mention below.
NoReverseMatch at /register
Log
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/register
Django Version: 4.1
Python Version: 3.10.4
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'website']
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 (most recent call last):
File "C:\Users\TarunMahajan\.virtualenvs\pracPy-b7vdO4P5\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
File "C:\Users\TarunMahajan\.virtualenvs\pracPy-b7vdO4P5\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\TarunMahajan\djangoProjects\pracPy\website\views.py", line 83, in register
return redirect('register')
File "C:\Users\TarunMahajan\.virtualenvs\pracPy-b7vdO4P5\lib\site-packages\django\shortcuts.py", line 48, in redirect
return redirect_class(resolve_url(to, *args, **kwargs))
File "C:\Users\TarunMahajan\.virtualenvs\pracPy-b7vdO4P5\lib\site-packages\django\shortcuts.py", line 145, in resolve_url
return reverse(to, args=args, kwargs=kwargs)
File "C:\Users\TarunMahajan\.virtualenvs\pracPy-b7vdO4P5\lib\site-packages\django\urls\base.py", line 88, in reverse
return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
File "C:\Users\TarunMahajan\.virtualenvs\pracPy-b7vdO4P5\lib\site-packages\django\urls\resolvers.py", line 803, in _reverse_with_prefix
raise NoReverseMatch(msg)
Exception Type: NoReverseMatch at /register
Exception Value: Reverse for 'register' not found. 'register' is not a valid view function or pattern name.
Here we can see register function is registered
Using the URLconf defined in tarunmahajan.urls, Django tried these URL patterns, in this order:
The text was updated successfully, but these errors were encountered: