I've been doing tutorial but in django 2.1 you have to use path, how do I translate to 2.1 django compatibile path function?
No, in django-2.x, you can use path [Django-doc] or re_path [Django-doc]. Furthermore as of today, url [Django-doc] is still supported, but will likely dissapear in the future.
re_path is in fact equivalent to the old url, so you can write this as:
re_path( r'^activate/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', views.activate, name='activate' ),
It is not easy to construct a completely equivalent URL, since Django only supports five path conversions by default:
Path converters
The following path converters are available by default:
str - Matches any non-empty string, excluding the path separator, '/'. This is the default if a converter isn't included in the expression. int - Matches zero or any positive integer. Returns an int. slug - Matches any slug string consisting of ASCII letters or numbers, plus the hyphen and underscore characters. For example, building-your-1st-django-site. uuid - Matches a formatted UUID. To prevent multiple URLs from mapping to the same page, dashes must be included and letters must be lowercase. For example, 075194d3-6885-417e-a8a8-6c931e272f00. Returns a UUID instance. path - Matches any non-empty string, including the path separator, '/'. This allows you to match against a complete URL path rather than just a segment of a URL path as with str.
We can use slug here, but this will match more than the given URL:
path( r'^activate/(<slug:uidb64>/<slug:token>/$', views.activate, name='activate' ),
The slug pattern takes as regex equivalent:
class SlugConverter(StringConverter): regex = '[-a-zA-Z0-9_]+'
path, but it is advisable to usere_path: docs.djangoproject.com/en/2.1/ref/urls/#django.urls.re_path