Skip to content
Snippets Groups Projects
Commit 7d8de3c8 authored by Flavio TARSETTI's avatar Flavio TARSETTI
Browse files

Merge branch '558_fix_url_prefix_urls' into 'django3_migration'

Simplify URL_PREFIX handling in urls.py

See merge request !387
parents 9fd1fd56 0cdb48d9
No related branches found
No related tags found
2 merge requests!387Simplify URL_PREFIX handling in urls.py,!342Django 3 migration
Pipeline #43091 passed
......@@ -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