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
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.
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"),
]