[WIP] Customizable theming fix background images issue #2006
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 duringcompilestatic
command)So when the collectstatic command is ran it will first look inside the
static-overrides
directory, 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-overrides
will be used in case we have files with same name instatic-overrides
andstatic
.During deployment, It is expected that
compilestatic
command will be ran first(which will generate the css, image files and store them to the static-override folder), and thencollectstatic
command 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-overrides
bycompilestatic
and copied toSTATIC_ROOT
bycollectstatic
command. The static files are still loaded directly fromstatic
instead ofSTATIC_ROOT
directory.(Happens when i run the dev environment through docker).I tried to play around with
DEBUG
,STATIC_ROOT
, andSTATIC_URL
in local dev settings.