django admin 中的密码重置功能不起作用
urls.py
from django.contrib import admin
from django.urls import path,include
from django.urls import re_path
from App.views import *
from.router import router
from django.views.generic import TemplateView
from rest_framework_simplejwt.views import ( TokenObtainPairView,TokenRefreshView)
from django.conf.urls.static import static
from django.conf import settings
from django.contrib.auth import views as auth_views
urlpatterns = [
path('', TemplateView.as_view(template_name="social_app/index.html")), #social_app/index.html
path('admin/', admin.site.urls), #admin api
path('api/',include(router.urls)), #api
path('accounts/', include('allauth.urls')), #allauth
re_path('rest-auth/', include('rest_auth.urls')), #rest_auth
path('api-auth/', include('rest_framework.urls')),
re_path('/registration/', include('rest_auth.registration.urls')),
path('api/token/', MyObtainTokenPairView.as_view(), name='token_obtain_pair'),
path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
path('jobview/',job),
path('timelog/',timelogview),
path('chaining/', include('smart_selects.urls')),
path('admin/password_reset/',auth_views.PasswordResetView.as_view(),name='admin_password_reset',),
path('admin/password_reset/done/',auth_views.PasswordResetDoneView.as_view(),name='password_reset_done',),
path('reset/<uidb64>/<token>/',auth_views.PasswordResetConfirmView.as_view(),name='password_reset_confirm',),
path('reset/done/',auth_views.PasswordResetCompleteView.as_view(),name='password_reset_complete',),
] + static(settings.STATIC_URL, document_root = settings.STATIC_ROOT)
我在管理页面登录中提供了密码重置功能,它显示为“忘记密码或用户名?”在页面中,但是当我单击它时,网址将 http://127.0.0.1:8000/admin/login/?next=/admin/password_reset/
更改为此,但正在加载相同的登录页面没有重定向到任何其他重置页面。
我已尝试但无法解决此问题,请帮助我解决此问题。
urls.py
from django.contrib import admin
from django.urls import path,include
from django.urls import re_path
from App.views import *
from.router import router
from django.views.generic import TemplateView
from rest_framework_simplejwt.views import ( TokenObtainPairView,TokenRefreshView)
from django.conf.urls.static import static
from django.conf import settings
from django.contrib.auth import views as auth_views
urlpatterns = [
path('', TemplateView.as_view(template_name="social_app/index.html")), #social_app/index.html
path('admin/', admin.site.urls), #admin api
path('api/',include(router.urls)), #api
path('accounts/', include('allauth.urls')), #allauth
re_path('rest-auth/', include('rest_auth.urls')), #rest_auth
path('api-auth/', include('rest_framework.urls')),
re_path('/registration/', include('rest_auth.registration.urls')),
path('api/token/', MyObtainTokenPairView.as_view(), name='token_obtain_pair'),
path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
path('jobview/',job),
path('timelog/',timelogview),
path('chaining/', include('smart_selects.urls')),
path('admin/password_reset/',auth_views.PasswordResetView.as_view(),name='admin_password_reset',),
path('admin/password_reset/done/',auth_views.PasswordResetDoneView.as_view(),name='password_reset_done',),
path('reset/<uidb64>/<token>/',auth_views.PasswordResetConfirmView.as_view(),name='password_reset_confirm',),
path('reset/done/',auth_views.PasswordResetCompleteView.as_view(),name='password_reset_complete',),
] + static(settings.STATIC_URL, document_root = settings.STATIC_ROOT)
I have given the password reset function in the admin page login, it is showing as "Forgotten your password or username?" in the page but when I click it the url changes http://127.0.0.1:8000/admin/login/?next=/admin/password_reset/
to this but the same login page is loading i didnt redirected to any other reset page.
I have tried but couldn't able to fix it, kindly help me to fix this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
path('admin/', admin.site.网址)
然后将这行代码添加到您的
admin.py
文件中并运行服务器并与您的管理员帐户连接,然后转到站点模型并编辑域example.com 与http://127.0.0.1:8000
当您正在开发中(在生产中它将是您的服务器链接)并使用您想要的网站名称编辑名称 example.com。Add all urls with
admin
beforepath('admin/', admin.site.urls)
Then add this line of code in your
admin.py
file and run the server and connect with your admin account then go to Site model and edit domain example.com withhttp://127.0.0.1:8000
when you're in development (in production it will be your server link) and edit name example.com with whatever name you want for your site.