[WIP] Customizable theming fix background images issue#2006
Draft
superryeti wants to merge 2 commits intoMIT-LCP:devfrom
Draft
[WIP] Customizable theming fix background images issue#2006superryeti wants to merge 2 commits intoMIT-LCP:devfrom
superryeti wants to merge 2 commits intoMIT-LCP:devfrom
Conversation
As discussed on MIT-LCP#1996, we are making the theme customizable for deployment by .env configuration. This lead us modifying existing css files adding configurable image files. This folder should be used to store deployment specific static files. It is expected that compilestatic will be ran first(which will generate the css, image files and store them to the static-override folder), and then collectstatic will be ran which will collect static files from static and static-override directories Note that, the `static-overrides` comes before the `static` on base.py This is intentional to make sure `static-overrides` is given first priority if there are same file in these two directories.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1996
Background: On PR #1986, we started to allow specific deployments of Physionet customize the theme of platform. This involved making the css styles, and static images configurable by using the .env file.
This #1986, introduced few bad designs and issues as pointed out by #1989 (tracked css files are being edited), and #1995 (downloading of files during installation).
This PR uses the suggestion provided by @alistairewj on #1996
Context:
This PR allows us to modify/customize the static files without messing with tracked file. As suggested by @alistairewj , we added a new directory
static-overrides(where the updated static files are saved duringcompilestaticcommand)So when the collectstatic command is ran it will first look inside the
static-overridesdirectory, and copy the files to theSTATIC_ROOT. As mentioned in https://docs.djangoproject.com/en/dev/howto/static-files/#serving-static-files-during-development, the files instatic-overrideswill be used in case we have files with same name instatic-overridesandstatic.During deployment, It is expected that
compilestaticcommand will be ran first(which will generate the css, image files and store them to the static-override folder), and thencollectstaticcommand will be ran which will collect static filesfrom static and static-override directories
Note: Regarding the part of code which lets us customize background image, i also added the option to allow someone to provide a link to background image because i am not sure if we can provide a local image path where the deployment happens in a container.
WIP: Currently, when the static files are generated in
static-overridesbycompilestaticand copied toSTATIC_ROOTbycollectstaticcommand. The static files are still loaded directly fromstaticinstead ofSTATIC_ROOTdirectory.(Happens when i run the dev environment through docker).I tried to play around with
DEBUG,STATIC_ROOT, andSTATIC_URLin local dev settings.