Django is a widely-used Python web application framework with a 'batteries-included' philosophy. It really looks like a bug.I mean, if all images must be in MEDIAROOT, then not finding an abstract path should raise an error because it seems sorl-thumbnail is looking in media/static/main/img/businessmaninthemirror.jpg and fails silently. I made a blog on Django and added images to form. I have a model like this model from sorl.thumbnail import ImageField class Book(models.Model): title models.CharField(maxlength255) thumb models.ImageFi. But then it does not copy or find the static file. Setting is usually completed in the settings.py document of your project. The cache system offers various options - cache can be preserved in database, on document program or straight in memory space. Well that made me crazy at some point: I did not see any exception or warning until I gave a path outside MEDIAROOT: SuspiciousFileOperation at /The joined path (/Users/quentin/Python/projects/static/main/img/businessmaninthemirror.jpg)is located outside of the base path component (/Users/quentin/Python/projects/djangoproject).So sorl-thumbnail is ok with my image' abstract static file because it's located under my django project path. To make use of cache in Django, first issue to do can be to established up where the cache will stay. I guess it is swallowed in a 'too general' except-clause somewhere?A way to work around this for static files is to prefix the static paths you pass to sorl-thumbnails with the domain name (e.g. If things are outside the MEDIAROOT you should see a suspicious file operation error raised by Django.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |