To Reproduce the bug
(install Weblate 4.x)
pip install Weblate
...
Change settings.py to set e.g. URL_PREFIX="/:weblate".
Change settings.py to set REQUIRE_LOGIN = True.
Run
weblate runserver
Go to address http://localhost:8000 with a web browser.
Actual behavior
Weblate redirects to localhost in infinite loop where response Location parameter next contains the previous request query string. This continues as long as the browser keeps trying (I think between 10-30 requests with common UAs).
Expected behavior
The runserver should answer along the lines
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1/
Using the URLconf defined in weblate.urls, Django tried these URL patterns, in this order:
:weblate/
and opening
http://localhost/:weblate/
should result in login screen.
Server configuration and status
$ lsb_release -d
Description: Ubuntu 20.04.1 LTS
$ pip show weblate
Name: Weblate
Version: 4.3.2
Summary: A web-based continuous localization system with tight version control integration
Home-page: https://weblate.org/
...
Workaround
The runserver seems to work if either URL_PREFIX is empty string or REQUIRE_LOGIN is false.
The default value for LOGIN_REQUIRED_URLS_EXCEPTIONS currently doesn't honour URL_PREFIX, so you will have to uncomment it in settings to workaround that.
Thank you for your report, the issue you have reported has just been fixed.