Skip to content
Snippets Groups Projects
Commit 0cdb48d9 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[urls] URL_PREFIX shall not contain a fully qualified URL therefore no need to parse it

parent 9fd1fd56
No related branches found
No related tags found
2 merge requests!387Simplify URL_PREFIX handling in urls.py,!342Django 3 migration
Pipeline #43089 passed
This commit is part of merge request !387. Comments created here will be created in the context of that merge request.
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment