Home > OS >  customize url on django
customize url on django

Time:09-30

I would like to set up a url path that takes into account any string consisting of ASCII letters or numbers, the hyphen or character and also a period. For example: localhost:8000/mysite/toto-25b.ko

How to set this up with re_path ?

CodePudding user response:

You can try this:

re_path(r'^mysite/(?P<account>[\w\d\-\.] )', views.account, name='account'),
  • Related