sorl-thumbnail

Table thumbnail_kvstore doesn't exist

▼魔方 西西 提交于 2019-12-20 17:27:40
问题 I can't get the thumbnail displayed in my template. I get this error: django.db.utils.ProgrammingError: (1146, "Table 'ia_website.thumbnail_kvstore' doesn't exist") Installed sorl_thumbnail-12.3 I'm using MariaDB 10.1.11 I have no migration that are not executed I can see the image if I don't use the 'thumbnail' tag Here is what I did In settings.py: INSTALLED_APPS = [ ... 'sorl.thumbnail', ] THUMBNAIL_DEBUG = TRUE In models.py import sorl ... image = sorl.thumbnail.ImageField(upload_to=

Table thumbnail_kvstore doesn't exist

情到浓时终转凉″ 提交于 2019-12-20 17:27:05
问题 I can't get the thumbnail displayed in my template. I get this error: django.db.utils.ProgrammingError: (1146, "Table 'ia_website.thumbnail_kvstore' doesn't exist") Installed sorl_thumbnail-12.3 I'm using MariaDB 10.1.11 I have no migration that are not executed I can see the image if I don't use the 'thumbnail' tag Here is what I did In settings.py: INSTALLED_APPS = [ ... 'sorl.thumbnail', ] THUMBNAIL_DEBUG = TRUE In models.py import sorl ... image = sorl.thumbnail.ImageField(upload_to=

sorl-thumbnail not creating thumbnails

纵然是瞬间 提交于 2019-12-20 02:26:15
问题 I'm having some difficulty with sorl-thumbnail . My template is as follows: {% thumbnail project.image "75x75" crop="center" as im %} <img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"> {% empty %} <p>:(</p> {% endthumbnail %} In my rendered webpage I get the following path for the thumbnail: <img src="/media/cache/ff/29/ff299c50543aa807b0fbd28faf271e63.jpg" width="75" height="75"> Now this all makes sense because my MEDIA_URL is set as /media/ which is mapped in my

sorl-thumnail resizing and saving

时光总嘲笑我的痴心妄想 提交于 2019-12-13 07:15:54
问题 I'm trying to use sorl-thumnail to resize the image in the views then saving it and getting IOError while calling get_thumnail(). Also I need to know how to save the resized image. Sorry if you consider this silly..I'm new to Django. Models.py: from django.db import models from django.forms import ModelForm from sorl.thumbnail import ImageField class BasicModel(models.Model): name = models.CharField(max_length=200) dob = models.DateField() photo = ImageField(upload_to='sample') class

Renaming sorl-thumbnail images in templates

假装没事ソ 提交于 2019-12-13 00:57:28
问题 I am using sorl-thumbnail via the thumbnail template tag in my Django templates, as follows: {% thumbnail foo.imgA "1600x1200" as im %} <a href='{{ im.url }}' title='{{ foo.imgA.url }}'> {% endthumbnail %} The original file name contains some information that is relevant to my users in case they download it. When I resize the image using sorl-thumbnail , the resized image gets a new name. Is there a way for the sorl-thumbnail -generated image to keep the name of the original file (perhaps

sorl-thumbnail: encoder error -2 when writing image file

北慕城南 提交于 2019-12-12 15:51:44
问题 I've been using sorl-thumbnail for some time without problems. However, the following error started to appear: encoder error -2 when writing image file . The following code causes the error: from sorl.thumbnail import get_thumbnail photobooth_thumbnail = get_thumbnail(img_file, PHOTOBOOTH_THUMB_SIZE, crop='center', quality=99) being img_file a Django models' ImageField and when PHOTOBOOTH_THUMB_SIZE is "sufficiently large". When I was using PHOTOBOOTH_THUMB_SIZE = '670' , everything worked

Check if sorl thumbnail has already cached an image using the low level API

允我心安 提交于 2019-12-12 06:45:16
问题 Sorl thumbnail has a low-level API that allows you to do, for example: from sorl.thumbnail import get_thumbnail im = get_thumbnail(my_file, '100x100', crop='center', quality=99) This returns a reference to the cached file. If it's already been created, it's super quick. However, if it has to create it for the first time it can take a long time when using remote storage such as S3. Is there a way to run a command in Python (ie. not in a template) to check if sorl will have to generate a

Django: sorl-thumbnail and hosting image files on my own file server

倾然丶 夕夏残阳落幕 提交于 2019-12-12 04:21:02
问题 I like very much sorl-thumbnail library and I want to store image files not in current application (django) server, but to (another) my own file server with webserver for serving static files. Do I have to write custom django storage or not? How can I upload files to remote static file server(s)? What if I have many application (django) servers and many file servers? Is it better to use custom file upload handler? And if not then when is it useful? And if yes then how to use it with sorl

Django shows 404 error on media files when debug = False in production

狂风中的少年 提交于 2019-12-11 16:28:59
问题 I'm trying to put a django website live and after going through the deployment checklist and turning debug = False django gives out a 404 error and only static files are loaded no media files uploaded from users are displayed. However with debug=True all the images and files work properly. below are the configurations of the project with debug = True . The console logs show multiple missing files.can someone point to me what i'm doing wrong? settings.py urls.py console errors 回答1: Basically

Django Migrating to a new Database

跟風遠走 提交于 2019-12-11 02:44:39
问题 I just joined a project using Django, and am attempting to initialize my own development server. When I attempt to do so, the migration fails for one of my apps. A model for this app has a sorl.thumbnail.ImageField, to add a logo. When the migration is attempted, I get the following error message: FATAL ERROR - The following SQL query failed: ALTER TABLE "accounts_account" ADD CONSTRAINT "logo_id_refs_file_ptr_id_7c3d1997" FOREIGN KEY ("logo_id") REFERENCES "filer_image" ("file_ptr_id")