feat: configurable frontend base path

Co-authored-by: Suraj Shetty <surajshetty3416@users.noreply.github.com>
This commit is contained in:
Hussain Nagaria
2026-01-17 23:04:31 +05:30
parent 376de99ef7
commit fe1aa3dd40
36 changed files with 177 additions and 78 deletions
+21 -10
View File
@@ -1,3 +1,5 @@
import frappe
from . import __version__ as app_version
app_name = "frappe_lms"
@@ -6,11 +8,13 @@ app_publisher = "Frappe"
app_description = "Frappe LMS App"
app_icon_url = "/assets/lms/images/lms-logo.png"
app_icon_title = "Learning"
app_icon_route = "/lms"
app_color = "grey"
app_email = "jannat@frappe.io"
app_license = "AGPL"
lms_path = frappe.conf.get("lms_path") or "lms"
app_icon_route = f"/{lms_path}"
# Includes in <head>
# ------------------
@@ -163,7 +167,8 @@ override_whitelisted_methods = {
# Add all simple route rules here
website_route_rules = [
{"from_route": "/lms/<path:app_path>", "to_route": "lms"},
{"from_route": f"/{lms_path}/<path:app_path>", "to_route": "_lms"},
{"from_route": f"/{lms_path}", "to_route": "_lms"},
{
"from_route": "/courses/<course_name>/<certificate_id>",
"to_route": "certificate",
@@ -172,24 +177,25 @@ website_route_rules = [
website_redirects = [
{"source": "/update-profile", "target": "/edit-profile"},
{"source": "/courses", "target": "/lms/courses"},
{"source": "/courses", "target": f"/{lms_path}/courses"},
{
"source": r"^/courses/.*$",
"target": "/lms/courses",
"target": f"/{lms_path}/courses",
},
{"source": "/batches", "target": "/lms/batches"},
{"source": "/batches", "target": f"/{lms_path}/batches"},
{
"source": r"/batches/(.*)",
"target": "/lms/batches",
"target": f"/{lms_path}/batches",
"match_with_query_string": True,
},
{"source": "/job-openings", "target": "/lms/job-openings"},
{"source": "/job-openings", "target": f"/{lms_path}/job-openings"},
{
"source": r"/job-openings/(.*)",
"target": "/lms/job-openings",
"target": f"/{lms_path}/job-openings",
"match_with_query_string": True,
},
{"source": "/statistics", "target": "/lms/statistics"},
{"source": "/statistics", "target": f"/{lms_path}/statistics"},
{"source": "_lms", "target": f"/{lms_path}"},
]
update_website_context = [
@@ -203,11 +209,16 @@ jinja = {
"lms.lms.utils.get_instructors",
"lms.lms.utils.get_lesson_index",
"lms.lms.utils.get_lesson_url",
"lms.lms.utils.get_lms_route",
"lms.lms.utils.is_instructor",
"lms.lms.utils.get_palette",
],
"filters": [],
}
extend_bootinfo = [
"lms.lms.utils.extend_bootinfo",
]
## Specify the additional tabs to be included in the user profile page.
## Each entry must be a subclass of lms.lms.plugins.ProfileTab
# profile_tabs = []
@@ -256,7 +267,7 @@ add_to_apps_screen = [
"name": "lms",
"logo": "/assets/lms/frontend/learning.svg",
"title": "Learning",
"route": "/lms",
"route": f"/{lms_path}",
"has_permission": "lms.lms.api.check_app_permission",
}
]