python - Django; How can i serve templates/images/css/js from inside custom 'skin' directory? -
i'm trying make skinnable django project.
what i'm having problems figuring out how can serve file(s) within skin directory, , not media dir, skin's images/css/js files can reside in skin's folder(s).
a user should able choose skin name , preferably altering skin_name variable in 'settings' (and maybe later .ini file). , templates/css/images loaded directory.
i imagine being able view raw templates bad, perhaps should 'media' directory inside skin folder, subfolders 'css', 'js' , 'images' inside, , served there.
i'm pretty new django framework though have python experience, input on how is/can done appreciated.
first thing, should rather keep static files in static
folder , use media
uploaded content.
then within static
folder have folder each of skin containing css, images , js needed.
from skin template import files prefixed both {{ static_url }} , skin name.
<link rel="stylesheet" src="{{ static_url }}name_of_your_skin/css/style.css" />
if skins not need separate template :
<link rel="stylesheet" src="{{ static_url }}{{ skin_name }}/css/style.css" />
Comments
Post a Comment