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

How to fix Django regualr expression Problem

Django Rest Framework after User registration sends out an Email for the new User to verify the EMail adress.
The link attached is like

https://my_domain.com/api/verify_email/?token=ddfddjrf....fddkfjdjh

my api.urls.py file looks like:

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

api.urls.py
from django.urls import re_path
from . import views

urlpatterns = [
   re_path(r'^verify_email/(?P<token>[\w.-]+)/',views.verify_email, name="verify_email"),
[

and in project urls.py

...
path('api/', include("api.urls")),
...

When I try to run that link I get:

Page not found (404)
The current path api/verify_email/, didn’t match any of these.

I can see a URL pattern from the URL.conf:
Django tried these URL patterns,in this order.

api/ ^verify_email/(?P[\w.-]+)/ [name=’verify_email’]

I hope somebody can help because I can’t find a solution somewhere ….
And I tried several things to fix it. But without any success.
Thank’s a lot.

Greetings RR

>Solution :

As the error says, it is lacking the token, so you visit it with:

/api/verify_email/ddfddjrf....fddkfjdjh/

not as part of the querystring.

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