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



Hi Jorge,
I have changed to it "password_reset" from "password-reset" 
But what i type www.roastias/password_reset/
it shows no url, but i have checked my folders so the templates/users/password_reset.html and reset of the password related urls in the folder
but not on the error page


On Saturday, February 1, 2020 at 2:10:01 PM UTC+8, jlgimeno71 wrote:
What I believe is going on is that Django is looking for the password reset view at password_reset, and that url path doesn't exist anywhere in urls.py.  I see a path named "password-reset", which won't match.

Let's try to rename that url conf to password_reset, and leave the rest unchanged.  Does anything change?

-Jorge

On Fri, Jan 31, 2020 at 9:21 PM Dave Ko <ko0...@gmail.com> wrote:

LOGIN_REDIRECT_URL = 'news:all_news'


all_news is the first page of the website

On Saturday, February 1, 2020 at 1:16:53 PM UTC+8, jlgimeno71 wrote:


On Fri, Jan 31, 2020 at 8:33 PM Dave Ko <ko0...@gmail.com> wrote:
 I also have some trouble with using signal, which works perfectly fine on localhost but not deployed


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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/697c8672-d832-4899-998e-f6d4d6eb8779%40googlegroups.com.

By chance did you set LOGIN_REDIRECT_URL in settings.py?

-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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0d5c6caf-65dc-4fc3-a69c-fe25d0eef2f2%40googlegroups.com.

--
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/42319de1-b5bb-47fd-bd37-e1f4b14ecf63%40googlegroups.com.

No comments:

Post a Comment