# gettext\_lazy and url patterns

**URL:** https://forum.djangoproject.com/t/gettext-lazy-and-url-patterns/43703
**Category:** Mystery Errors
**Created:** [December 12, 2025, 1:22pm UTC](https://forum.djangoproject.com/t/gettext-lazy-and-url-patterns/43703 "2025-12-12T13:22:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![andreage](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/andreage/32/21451_2.png) [@andreage](https://forum.djangoproject.com/u/andreage)
#### Post date: [December 12, 2025, 1:22pm UTC](https://forum.djangoproject.com/t/gettext-lazy-and-url-patterns/43703/1 "2025-12-12T13:22:18Z")

</div>

I have a quite complex application, which was working fine with Django 5.2.9 and does not work with django 6.0.

When I use the command `runserver` and I access any page I get:

A server error occurred. Please contact the administrator.

My main `urls.py` after removing everything else for testing purposes is:

```python
from django.urls import include, path
from django.utils.translation import gettext_lazy

urlpatterns = [
    path(gettext_lazy('invitation/'), include('invitation.urls')),
]

```

and the `invitation.urls` is:

```python
from django.urls import path
from django.utils.translation import gettext_lazy
from django.views.generic import TemplateView

urlpatterns = [
    path(gettext_lazy('request/'), TemplateView.as_view(template_name='invitation/request.html'), name='invitation.request'),
]

```

If I remove `gettext_laxy` from `path(gettext_lazy('invitation/'), include('invitation.urls'))` (but leaving it in `invitation.urls`) the error disappears.

If I remove it from `invitation.urls` but leave it in `urls.py` the error remains.

Something like the following in `urls.py` works just fine:

```python
path(gettext_lazy('about/'), TemplateView.as_view(template_name='about.html'), name='about'),

```

The error I get in the console is the following:

```auto
Traceback (most recent call last):
  File "/home/andrea/virtualenv/entertainment/lib/python3.13/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/home/andrea/virtualenv/entertainment/lib/python3.13/site-packages/django/core/handlers/base.py", line 182, in _get_response
    callback, callback_args, callback_kwargs = self.resolve_request(request)
                                               ~~~~~~~~~~~~~~~~~~~~ ^^^^^^^^^
  File "/home/andrea/virtualenv/entertainment/lib/python3.13/site-packages/django/core/handlers/base.py", line 314, in resolve_request
    resolver_match = resolver.resolve(request.path_info)
  File "/home/andrea/virtualenv/entertainment/lib/python3.13/site-packages/django/urls/resolvers.py", line 678, in resolve
    sub_match = pattern.resolve(new_path)
  File "/home/andrea/virtualenv/entertainment/lib/python3.13/site-packages/django/urls/resolvers.py", line 673, in resolve
    match = self.pattern.match(path)
  File "/home/andrea/virtualenv/entertainment/lib/python3.13/site-packages/django/urls/resolvers.py", line 344, in match
    elif path.startswith(self._route):
         ~~~~~~~~~~~~~~~ ^^^^^^^^^^^^^
TypeError: startswith first arg must be str or a tuple of str, not __proxy__

During handling of the above exception, another exception occurred:

```

(at this point the message above is repeated in an infinite loop).

It might be related to this commit:

> <https://github.com/django/django/commit/f920937c8a63df6bea220e4386f59cdb45b2e355>

amending it with:

```python
elif path.startswith(str(self._route)):
    return path.removeprefix(str(self._route)), (), {}

```

fixes the issue.

Ticket:

> **[\#36796 (gettext\_lazy and url patterns)
          – Django](https://code.djangoproject.com/ticket/36796)**
