Commit 7d8de3c8 authored by Flavio TARSETTI's avatar Flavio TARSETTI

Merge branch '558_fix_url_prefix_urls' into 'django3_migration'

Simplify URL_PREFIX handling in urls.py

See merge request !387
parents 9fd1fd56 0cdb48d9
Pipeline #43091 passed with stage
in 15 minutes and 27 seconds
......@@ -25,7 +25,6 @@
# #
###############################################################################
from urllib.parse import urlparse
from django.conf import settings
from django.conf.urls import include
......@@ -108,10 +107,9 @@ unprefixed_patterns += [
# Process an eventual prefix in the URLs
parsed_url = urlparse(settings.URL_PREFIX)
if (parsed_url.path != "") and (parsed_url.path != "/"):
if settings.URL_PREFIX not in ["", "/"]:
urlpatterns = [
url(r"^%s/" % parsed_url.path[1:], include(unprefixed_patterns)),
url(r"^%s/" % settings.URL_PREFIX[1:], include(unprefixed_patterns)),
]
else:
urlpatterns = unprefixed_patterns
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment