I’m trying to use the jQuery LighBox plugin in my Django app, by the Javascript appears to generate HTML to hard-coded image paths (e.g. images/loading.gif). How do I customize these image paths so they point to my Media directory?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What you need is not “media“, rather “static” files. “media” is aimed at serving user images etc., while “static” is designed to contain static content (such as CSS styles, JS scripts, images used by CSS, logo etc.).
Detailed guide is here: https://docs.djangoproject.com/en/dev/howto/static-files/
Basically you need to put static files of lightbox interface somewhere in
/static/directory within your Django app. During deployment you will need to collect static files to the separate directory usingcollectstaticmanagement command.If you will use
{{ STATIC_URL }}within template, the paths will be generated correctly (STATIC_URLwithin templates having request context contains the URL of your static files directory). Just make sure you use proper settings for static files (mostlySTATIC_URLandSTATIC_DIR, details are under the link I have given).