<div class="col-xs-4 col-sm-3"> <a class="thumbnail" rel="#image-1" title="Amsterdam Holland" href="/static/media/uploads/gallery/Amsterdam%2C%20Holland.jpg"> <img class="img-responsive" src="/static/media/"> </a> </div>
I should have something like this:
<div class="col-xs-4 col-sm-3"> <a class="thumbnail" rel="#image-1" title="Amsterdam Holland" href="/static/media/uploads/gallery/Amsterdam%2C%20Holland.jpg"> <img class="img-responsive" src="/static/media/uploads/gallery/.thumbnails/Amsterdam%2C%20Holland.jpg/Amsterdam%2C%20Holland-131x75.jpg"> </a> </div>
I have made sure that the security on the files in question is permissive, like so:
<Directory /srv/www/blog-sites/mywebsite/static>
Require all granted
</Directory>
<Directory /srv/www/blog-sites/mywebsite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
SELinux is disabled, at least for this testing. The only clue I can find is in the error logs:
[Sat Jun 10 12:52:44.250023 2017] [autoindex:error] [pid 4638] [client 140.254.70.225:34634] AH01276: Cannot serve directory /srv/www/blog-sites/mysite_net/static/media/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive, referer: http://www.mysite.net/test-post-two/
Does anyone have an idea as to what may be going wrong here?
Thanks!
-JK
One update. I was able to get rid of the error related to Indexes, but the graphic URLs are still not being formed properly (and therefore, no graphics are shown).
One update. I was able to get rid of the error related to Indexes
...it tries to import PIL, but it fails. When I switch to this
virtualenv and try to import Image from PIL, I get an error about
loading a JPEG shared library. So I need to chase down why this JPEG
library isn't there.
Hi Karim,
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.)
--
Melvyn Sopacua
On Monday 12 June 2017 18:12:58 Karim wrote:
> On Sun, Jun 11, 2017 at 10:43 PM, Melvyn Sopacua
> 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.
--
Melvyn Sopacua
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.
On Monday 12 June 2017 20:47:33 Karim wrote:
> ​If I try the mezzanine_tags:​
>
> In [3]: from mezzanine.core.templatetags.mezzanine_tags import
> thumbnail ...: img = '/home//myuser/webapps/kng_static/media/upload/test_image.jpg'
Thumbnail takes a URL not a filesystem path.
--
Melvyn Sopacua