Friday, January 31, 2020

Re: Big Problem After Going Live: NoReverseMatch at /login/ Reverse for 'password_reset' not found. 'password_reset' is not a valid view function or pattern name


LOGIN_REDIRECT_URL = 'news:all_news'

On Saturday, February 1, 2020 at 12:20:29 PM UTC+8, jlgimeno71 wrote:

On Fri, Jan 31, 2020 at 5:35 PM Dave Ko <ko0...@gmail.com> wrote:
Hi everyone,

I am pretty new to django programming, I was following a tutorial and try to set up a blog,
everything seems to fine on my localhost machine, but after deployment and fixing some bugs,
I run into a problem which I have no idea what to do even with hours of search on stackoverflow.

So, here is my problem, I have made a login page, register page.
After deployment there is not other users besides admin,
but after register, when i try to login, it goes to error page you can see over here roasitas.com/login/

Screenshot 2020-02-01 at 9.27.48 AM.png


here is my urls.py 

I really want finish this blog and keep building it please help me out, thanks in advance!


from django.conf.urls.static import static
from rest_framework import routers, serializers, viewsets
from users import views as users_view
from django.contrib.auth import views as auth_views
from news import views as news_views
from news.models import Writer, News
from news.serializers import UserSerializer, NewsSerializer

urlpatterns = [
   path('',include('news.urls', namespace="news")),
   path('admin/', admin.site.urls),
   path('register/', users_view.register, name='register'),
   path('profile/', users_view.profile, name='profile'),
   path('login/', auth_views.LoginView.as_view(template_name='users/login.html'), name='login'),
   path('logout/', auth_views.LogoutView.as_view(template_name='users/logout.html'), name='logout'),
   path('password-reset/',
        auth_views.PasswordResetView.as_view(
           template_name='users/password_reset.html',
           subject_template_name='users/password_reset_subject.txt',
           success_url=reverse_lazy('users:password_reset_done')
        ),
        name='password_reset'),

    path('password-reset/done/',
        auth_views.PasswordResetDoneView.as_view(
            template_name='users/password_reset_done.html'
        ),
        name='password_reset_done'),

    path('password-reset-confirm/<uidb64>/<token>/',
   auth_views.PasswordResetConfirmView.as_view(
       template_name='users/password_reset_confirm.html'
       ),
   name='password_reset_confirm'),

     path('password-reset-complete/',
        auth_views.PasswordResetCompleteView.as_view(
            template_name='users/password_reset_complete.html'
        ),
        name='password_reset_complete'),

    path('api/', include(router.urls)),
   path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
   path('/tinymce/', include('tinymce.urls')),

]

if settings.DEBUG:
   urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/561c6b97-6428-4af2-a1dc-09af93387b77%40googlegroups.com.

I attempted to create an account and log in, and it worked for me! Your urls don't have a path to password_reset in the url.  That's the usual culprit for that exception to be raised.

-Jorge

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/87f16c5e-e9f4-48dc-9afe-ae6f25dc87a8%40googlegroups.com.

No comments:

Post a Comment