Search code examples
djangocookiecutter-django

Tilde (~) symbol on Django regex url (Cookiecutter Django)


After installing Cookiecutter Django i saw the tilde (~) symbol in regex and don't know the meaning for url purposes.

It's related to a regular expression or only a way to declare paths?

./users/urls.py:

urlpatterns = [
    ...
    url(
        regex=r'^~redirect/$',
    ...
    url(
        regex=r'^~update/$',
    ...
]

Solution

  • ~ does not have any special meaning in a regular expression. The url pattern matches the path /~redirect/ literally.