Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Trying to send Validation Email in django, getting error

Im trying to send validation email when creating a user in django. It used to work like that but then I did some refactoring on the URLs and used urlpattern = UrlPattern() and urlpattern.register(UserView). That is in the main django project url.py

In the app url.py Im having

from django.urls import path
from myapp import backend


urlpatterns = [
    path('activate/<uidb64>/<token>', backend.activate, name='activate')

    ]

Here are the project urls

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

from myapp.views import RoomView, UserView
from django_request_mapping import UrlPattern

urlpatterns = UrlPattern()

urlpatterns.register(UserView)
urlpatterns.register(RoomView)

where activate is a function in backend_logic, which used to work and send the email to the one from request. However, now Im getting the error

Reverse for ‘activate’ not found. ‘activate’ is not a valid view function or pattern name.

>Solution :

Run python manage.py show_urls to see is your URL registered properly or not. (It’s part of django-extensions package, very useful.)

If not, include yours app’s urls into your project urls.py.

Example:

# project urls.py
from django.urls import path, include

urlpatterns = [
    path("", include("shop.urls")),
]
# app shop/urls.py
from django.urls import path

from shop.views import catalog

urlpatterns = [
    path("", catalog.CatalogueView.as_view(), name="home"),
]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading