On Monday 12 June 2017 18:12:58 Karim wrote: > On Sun, Jun 11, 2017 at 10:43 PM, Melvyn Sopacua > <[email protected]> > wrote: > > On Sunday 11 June 2017 08:26:44 Karim wrote: > > > UPDATE > > > > > > > > > > > > if STATIC_URL and MEDIA_URL are set with the `http://....` the img > > > are > > > > > > correctly rendered in the posts with the right `src`. > > > > > > > > > > > > The thumbnails generation in django-filebrowser is still broken > > > > > > because point to `static/media` > > > > If STATIC_URL fixes part of your problem, then your setting is > > incorrect. Make sure they are absolute, not relative, so /static/ > > not static/. > > > > > > > > If no thumbnails are generated on disk, then (like Joshua) the > > problem is with Pillow. > > > > You can test what happens in a django shell as follows: > > >>> from mezzanine.core.templatetags.mezzanine_tags import thumbnail > > >>> > > >>> thumbnail('/media/uploads/foo.jpg', 80, 80) > > > > (needs to be an existing image bigger then 80x80 for any Pillow > > runtime related errors to surface.) > > ​Thanks, I think you pointed me to the right way to solve this. > > SuspiciousFileOperation: The joined path > (.../kng_static/media/uploads/qa_fields.png) is located outside of the > base path component (.../kng/kng_site/static/media)​ > > ​This happens because the `static` dir in my project is a link to > another dir.â€
Use os.path.realpath() in your settings file. The drawback being that changing the target of the symlink requires a reload of Django/WSGI for it to be picked up. This is not by definition a bad thing. A similar approach is to implement your own storage engine and call os.path.realpath on STATIC_ROOT. Of course, this opens you up to symlink attacks. Personally, I use bind mounts[1]. -- Melvyn Sopacua -------- [1] https://unix.stackexchange.com/questions/198590/what-is-a-bind-mount -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
