[Answer]-Django: How to specify custom media directory for JQuery lightbox plugin?

1πŸ‘

βœ…

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 using collectstatic management command.

If you will use {{ STATIC_URL }} within template, the paths will be generated correctly (STATIC_URL within templates having request context contains the URL of your static files directory). Just make sure you use proper settings for static files (mostly STATIC_URL and STATIC_DIR, details are under the link I have given).

πŸ‘€Tadeck

Leave a comment