Skip to content
Snippets Groups Projects
Commit 2f096418 authored by Carlos Vega's avatar Carlos Vega
Browse files

improvement: added support for app url prefix

parent 482f67c5
No related branches found
No related tags found
1 merge request!445Support for Python 3.11
Pipeline #81018 passed
......@@ -4,8 +4,9 @@ smasch (1.3.1-1) stable; urgency=medium
deprectation warnings
* dependencies: updated python related dependencies
* dependencies: updated npm packages and removed unused packages
* breaking change: dropped support for python < 3.9
* breaking change: dropped support for python < 3.9 (now supports python 3.11)
* docker: upgraded docker file and docker compose yml
* small improvement: allow the definition of a prefix to access as /smasch/*
-- Carlos Vega <carlos.vega@lih.lu> Tue, 7 Nov 2023 10:35:00 +0200
......
......@@ -89,3 +89,8 @@ NPM_ROOT_PATH = '/path/to/smasch/'
AUTH_LDAP_SERVER_URI = "ldap://lcsb-cdc-lums-01.uni.lu"
AUTH_LDAP_BASE_DN = "cn=users,cn=accounts,dc=uni,dc=lu"
# In order to support a prefix in the path, we should define the following variable SMASCH_PATH_PREFIX and override the STATIC_URL and MEDIA_URL
# SMASCH_PATH_PREFIX = "smasch/"
# STATIC_URL = "/smasch/static/"
# MEDIA_URL = "/smasch/media/"
\ No newline at end of file
......@@ -183,6 +183,9 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
# In order to support a prefix in the path, we should define the following variable SMASCH_PATH_PREFIX and override the STATIC_URL and MEDIA_URL
# this can be overriden in the local_settings.py file
SMASCH_PATH_PREFIX = ""
STATIC_URL = "/static/"
MEDIA_URL = "/media/"
......
......@@ -30,12 +30,16 @@ handler500 = "web.views.e500_error"
handler403 = "web.views.e403_permission_denied"
handler400 = "web.views.e400_bad_request"
if settings.SMASCH_PATH_PREFIX != "":
url_prefix = settings.SMASCH_PATH_PREFIX.lstrip("/").rstrip("/") + "/"
else:
url_prefix = ""
urlpatterns = [
re_path(r"^admin/", admin.site.urls),
re_path(r"", include(urls)),
re_path(r"^api/", include(api_urls)),
re_path(r"", include(tf_urls)),
re_path(rf"^{url_prefix}admin/", admin.site.urls),
re_path(rf"{url_prefix}", include(urls)),
re_path(rf"^{url_prefix}api/", include(api_urls)),
re_path(rf"{url_prefix}", include(tf_urls)),
]
if settings.SERVE_STATIC or settings.DEBUG:
......
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