Can't create custom home.html page

Hi Fox_Piacenti,

I am trying to add a custom home page called “home.html” which should be available at url like “ https://demolms.xxxxx.com/home ” which contains summary view of my enrolled courses and some static content. When user logs into “ https://demolms.xxxxx.com ”, he should be able to see the attached sample home page and not default dashboard. I tried including the dashboard.html file using <%include file='dashboard.html' /> in “home.html” to get the “My Courses” dynamic content, but it gives 500 error. What steps/configurations/modifications am I missing here. I am new to tutor and openedx. I am using “tutor” with a custom-theme in the tutor ec2 instance. I appreciate it if you could help.

Thanks,
Santosh Divate

Hi @nedbat/@Fox_Piacenti,

I have checked lot of blogs and posts but I was unable to find anything related to how we can add a custom page and map it at the backend in tutor. I would appreciate it if anyone could help.

Thanks,
Santosh Divate.

Hi, @santosh827 – I don’t have much experience with tutor so I can’t help you there. @regis may be able to help, or may know someone who can.

I think you’ll have to add entry of “/home” url in urls.py inside lms folder and add views.

Template you can add in

"edx-platform/openedx/core/djangoapps/userauthn/urls.py"

For example:

from lms.djangoapps.static_template_view import views as static_template_views

urlpatterns += [
        url(r'^home$', static_template_views.render, {'template': 'home.html'}, name="home"),
]

Hi Vikrant,

So in ‘home.html’ can we add the “dashboard.html” code and modify the view as we need? Also any idea how to implement this if we are using tutor as tutor installation doesn’t provide us with the files like “urls.py”?

Thanks,

Hi Santosh if you are using tutor you can run “tutor local exec lms bash” which will take you to “edx-platform” directory for that container
You can edit the file inside same container
I’m not sure about adding code of dashboard.html yet. Perhaps if we can get the “/home” working we can do that as a next step.

Hi Vikrant,

So if we run the command “tutor local exec lms bash” and do the changes in the respective files, will these changes be reflected immediately? Do we have to run the build image command “tutor images build openedx” and restart I am not sure if those changes will be applied even after we run the build image command "tutor images build openedx". Please let me know if this assumption is valid or not.

I think simple restart like “tutor local stop lms; tutor local start lms -d” should do the job

Thanks Vikrant.
Will try these changes and get back to you.

Also like is there any file where I can change the default page from ‘/dashboard’ to ‘/home’ when the user logs into the lms?

Are you using custom theme for your tutor app? If so I guess from template using js you can validate login data and do

window.location.href = "/home";

I’m not sure if it’s a proper way but this should work

Hi Vikrant,

Yes, I am using custom theme. Oh ok then i’ll try this way and let you know. Thank you so much.

1 Like