As re_path and url syntax utilize regex, true optional trailing slashes are allowed for with the following example:
re_path(r'^about/?$', AboutView.as_view(), name='about')
In this example, a request to both /about and /about/ would yield a 200 response.
Using path would look like this:
path('about/', AboutView.as_view(), name='about')
Assuming we have APPEND_SLASH set to true in our settings, a request to 'about' would yield a redirect with a 300, and a request to 'about/' would yield a 200.
Moreover, using path without the slash would look like this:
path('about', AboutView.as_view(), name='about')
Here we'd obtain a 400 when trying to access 'about/', as intended.
It is impossible to obtain the same behavior when migrating from url/re_path to path. Although it is better design to not allow for two valid endpoints for the same path, I believe we should support the ability to easily maintain the same behavior during migrations.
A solution may be to add a simple parameter for path, so that our route declaration would look something like this:
path('about', AboutView.as_view(), name='about', optional_slash=True)
or
path('about/', AboutView.as_view(), name='about', optional_slash=True)
Another design may be to declare a new global like OPTIONAL_TRAILING_SLASH similar to APPEND_SLASH in our middleware.