How to change the Django-allauth default url patterns?

Viewed 931

while using the django-allauth as the registeration system, the following codes work well:

urls.py

urlpatterns = [
    path('accounts/', include('allauth.urls')),
    path('admin/', admin.site.urls),
    ...
]

so, under this settings:

  • when the user wants to signin, then go to 'example.com/accounts/login'
  • when the user wants to signup, then go to 'example.com/accounts/singup'
  • ...

but now I want to change the urls to something like:

  • when the user wants to signin, then go to 'example.com/staff/login'
  • when the user wants to signup, then go to 'example.com/staff/singup'
  • ...

I just want to change 'accounts' in the urls to 'staff'.

I've just tried to revise the urls.py to:

urlpatterns = [
    path('staff/', include('allauth.urls')),
    path('admin/', admin.site.urls),
]

most of the registration funcitons worked well, except the email comfirmtion.

I reveived the confirmation email and clicked on the comfirmation button, but then the redirect url will always be 'example.com/accounts/login', which raise a 404 error.

I want to know how to fix this problem, I will:

  • fix it, if this can be done in a few steps
  • use the default settings, if this is complicated or will bring some risks.

Versions:

  • Python: 3.8.1
  • Django: 3.0.4
  • Django-allauth:0.41.0

I am a freshman on coding (and English), thank you very very much.

0 Answers
Related