Skip to content

WL-325: Multi-Site Comprehensive Theming - #11885

Merged
mattdrayer merged 1 commit into
masterfrom
saleem-latif/WL-328
Mar 28, 2016
Merged

WL-325: Multi-Site Comprehensive Theming#11885
mattdrayer merged 1 commit into
masterfrom
saleem-latif/WL-328

Conversation

@saleem-latif

Copy link
Copy Markdown
Contributor

Hi @mattdrayer , @ziafazal

Kindly review this PR, it contains changes required to support multi-tenant comprehensive theming solution. Themes enable developers to override mako and django templates, static assets, sass styling etc.

JIRA ticket WL-325 and it subtasks contain more information about the changes included in this PR.

Here is a lsit of changes included,

  1. Update LMS to use Django Sites framework (WL-326)
  2. Add SiteTheme model to LMS (WL-328)
  3. Multi-tenancy support for Mako templates
  4. Change Comprehensive Theming Behaviour for static assets to support Multi-Tenancy (WL-321)
  5. Updated existing Comprehensive Theming and IS_EDX_DOMAIN tests
  6. Update django wiki to support multi-tenancy (WL-322)
  7. Updates sass compilation path so that scss in themes overrides lms/cms's sass files (WL-299)

A sandbox is available, with four sites currently configured:

Comment thread cms/envs/aws.py Outdated
"MICROSITE_DATABASE_TEMPLATE_CACHE_TTL", MICROSITE_DATABASE_TEMPLATE_CACHE_TTL
)

FOOTER_CACHE_TIMEOUT = ENV_TOKENS.get('FOOTER_CACHE_TIMEOUT', FOOTER_CACHE_TIMEOUT)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In lms/envs/aws.py this settings parameter is located in a section named 'Branded footer' -- I think it would be good to do that in this file as well, because right now it looks like it's part of the microsite configuration set and that's not really true.

@mattdrayer

Copy link
Copy Markdown
Contributor

@saleem-latif I have made an initial pass through the updated branch -- overall I am really liking what we have here! It will definitely be good if @ziafazal can also review the code, and I will take another look on my next cycle. Once we three are happy with things we can squash things up and go a second round with some other people.

@saleem-latif
saleem-latif force-pushed the saleem-latif/WL-328 branch 3 times, most recently from 78cfac5 to 5979be1 Compare March 24, 2016 11:38

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not theme paths be self.path = Path(get_base_theme_dir()) / theme_dir? if we want to get themes path with project root or component we can created a method in this class to return component path.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems there is only one reference to Theme.path at the moment, so I am okay leaving it as-is for the time being.

@ziafazal

Copy link
Copy Markdown
Contributor

@saleem-latif @mattdrayer overall LGTM but turning a huge PR.

@mattdrayer

Copy link
Copy Markdown
Contributor

jenkins run lettuce

@mattdrayer

Copy link
Copy Markdown
Contributor

Just a follow up to @ziafazal's comment about the PR becoming complicated. By 'complicated' here we mean there are several major components of the system being modified in the same changeset. However these changes are all required in order for the feature to be considered complete/viable. These changes are as follows:

  1. Comprehensive theming support for mako templates
  2. Comprehensive theming support for django templates and the course wiki
  3. Comprehensive theming support for static files (css, js, etc.)

While it would be possible to structure these changes as three separate PRs, or even three commits in the same PR, we have decided that it is best to continue bundling all of these changes into a single PR + single commit which best reflects the overall implementation of "Multi-Site Comprehensive Theming".

@mattdrayer

Copy link
Copy Markdown
Contributor

@felipemontoya @mtyaka, FYI on this updated PR

@mattdrayer

Copy link
Copy Markdown
Contributor

@andy-armstrong -- as discussed earlier, here is the updated PR for multi-site comprehensive theming support in LMS. It should look fairly familiar to the previous change set, with fixes for static asset caching and some all-around improvements to the code. In addition, a sandbox is available, with four sites currently configured:

@mattdrayer
mattdrayer force-pushed the saleem-latif/WL-328 branch from 5979be1 to 7c9c10a Compare March 24, 2016 19:31
@andy-armstrong

Copy link
Copy Markdown
Contributor

@saleem-latif @mattdrayer Thanks for creating all the sandboxes. That is a great demonstration of the capabilities. I wasn't able to fully test due to the bug with Underscore on sandboxes (which I'm fixing here: https://github.com/edx/edx-platform/pull/11938), but everything I could reach had the correct caching behavior.

I'll do a re-review of the code either later tonight or some time tomorrow.

@mattdrayer

Copy link
Copy Markdown
Contributor

@andy-armstrong the cool thing is that all of these sites and themes are being served by just one sandbox!

@mtyaka

mtyaka commented Mar 25, 2016

Copy link
Copy Markdown
Contributor

@saleem-latif @mattdrayer I only had a quick looks so far, but this looks great! Very nice work.

The https://stanford-theme.sandbox.edx.org/ currently loads with the red theme for me. Is that a bug or just misconfiguration?

screen shot 2016-03-25 at 17 55 27

@mattdrayer

Copy link
Copy Markdown
Contributor

Ah, that was a left over thing from a demo I gave earlier today -- I have changed it back to 'stanford-style' which is easy enough to do via the Django admin! (note the cached theme timeout is 30 mins by default)

@mattdrayer
mattdrayer force-pushed the saleem-latif/WL-328 branch from 7c9c10a to 762d81c Compare March 25, 2016 18:14
@andy-armstrong

Copy link
Copy Markdown
Contributor

@mattdrayer Could you rebase the branch and update the sandbox as the problem with Underscore should be fixed. Thanks!

@mattdrayer
mattdrayer force-pushed the saleem-latif/WL-328 branch from 762d81c to eb49e22 Compare March 25, 2016 21:36
@mattdrayer

Copy link
Copy Markdown
Contributor

Rebased!

@felipemontoya

Copy link
Copy Markdown
Member

@saleem-latif @mattdrayer I went through the changeset carefully and I like the direction this PR went. I will be testing this changes tomorrow morning in a more complex environment, to be sure nothing new comes up. Very nice work!

@andy-armstrong

Copy link
Copy Markdown
Contributor

Wow, this got huge! Very impressive work @saleem-latif. 👍

@mattdrayer

Copy link
Copy Markdown
Contributor

Beauty! I have to squash one commit and then this one will be good to go -- thanks much, @andy-armstrong!

ziafazal: improvements need for multi-tenancy
ziafazal: fixed broken tests
ziafazal: no need to add setting in test.py
ziafazal: added hostname validation
ziafazal: changes after feedback from mattdrayer
ziafazal: fixed branding and microsite broken tests
ziafazal: make STATICFILES_DIRS to list
ziafazal: added theme directory to mako lookup for tests
ziafazal: added more protection in test_util
saleem-latif: Enable SCSS Overrides for Comprehensive Theming
saleem-latif: Incoporate feedback changes, Correct test failures, add tests and enable theming for django templates
saleem-latif: Correct errors in python tests
mattdrayer: Fix invalid release reference
mattdrayer: Update django-wiki reference to latest release
saleem-latif: Update Theme storages to work with Caching, Pipeline and collectstatic
saleem-latif: Incorporate feedback changes
mattdrayer: Pylint violation fix
mattdrayer: Fix broken pavelib test
@mattdrayer
mattdrayer force-pushed the saleem-latif/WL-328 branch from a7ee17d to a796b56 Compare March 28, 2016 18:57
@mattdrayer

Copy link
Copy Markdown
Contributor

jenkins run bokchoy

@mattdrayer

Copy link
Copy Markdown
Contributor

We have an almost green build here -- the bok choy failure is due to a flaky test (ref. FED-99). Aside from this issue everything else looks stellar, so I'm going ahead with the merge.

@mattdrayer
mattdrayer merged commit ed0c261 into master Mar 28, 2016

# if site theme dir is not in cache and comprehensive theming is enabled then pull it from db.
if not site_theme_dir and is_comprehensive_theming_enabled():
site_theme = site.themes.first() # pylint: disable=no-member

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saleem-latif This line is causing WL-377 issue which blocks a CAT-2 TNL-4155

Can you please have look at this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants