python - Minimal developer setup of sorl-thumbnail with Django 1.7 -



python - Minimal developer setup of sorl-thumbnail with Django 1.7 -

my initial goal utilize sorl-thumbnail in basic way cache on filesystem cropped images downloaded external sites. don't care performance @ moment , don't want yet setup systems (memcachedb, redis). using development runserver.

on 1 hand docs create sound must utilize 1 of these 2 options. sense other places have read can setup not require these kv stores. 1 evidence that, see setting sorl.thumbnail.kvstores.dbm_kvstore.kvstore in reference docs (which says a simple key value store has no dependencies outside standard python library , uses dbm modules store data.), cannot work either (see below).

using python 2.7.5, django 1.7.1, pillow 2.6.1, , sorl-thumbnail 12.1c.

added sorl.thumbnail part of installed_apps.

added settings.py:

thumbnail_debug = true import logging sorl.thumbnail.log import thumbnailloghandler handler = thumbnailloghandler() handler.setlevel(logging.debug) logging.getlogger('sorl.thumbnail').addhandler(handler)

i see no other logging in web server console despite this.

attempted sync db:

$ ./manage.py migrate thumbnail operations perform: apply migrations: thumbnail running migrations: applying thumbnail.0001_initial... faked

no tables appear added database.

at point, i've added template load directive , next snippet, item.image_url models.urlfield works fine apart thumbnail.

{% thumbnail item.image_url "235x200" crop="center" im %} <img src="{{ im.url }}"> {% empty %} <p>no image</p> {% endthumbnail %}

when seek view page, see broken image links:

http://127.0.0.1:8001/<myapp>/cache/cf/43/cf43126f1f961593650b5df4791e329f.jpg 404 (not found)

my media_url not set, though tried playing no avail.

i farther tried putting settings: thumbnail_kvstore = 'sorl.thumbnail.kvstores.dbm_kvstore.kvstore' gives django error in browser: error importing module sorl.thumbnail.kvstores.dbm_kvstore: "no module named dbm_kvstore".

can configure in way, not requiring memcached, , if so, of settings wrong/missing? if must utilize memcached, how many more settings must configure in add-on installation? thanks.

update

here settings involving static assets.

static_url = '/static/' static_root = '/tmp/static/' staticfiles_dirs = ( project_root.child("static"), ) staticfiles_finders = ( 'django.contrib.staticfiles.finders.filesystemfinder', 'django.contrib.staticfiles.finders.appdirectoriesfinder', #'django.contrib.staticfiles.finders.defaultstoragefinder', if enabled breaks less css. 'static_precompiler.finders.staticprecompilerfinder', ) # staticfiles_storage not set should default 'django.contrib.staticfiles.storage.staticfilesstorage'

i serving static images mysite/static/img. , forgot mention using django static precompiler less css. less files @ mysite/static/css , compiled /tmp/static/compiled/.

i see there cache dir in project root mysite, , have file trying served: cache/6a/a6/6aa6ebf6cef5bf481fd37d4947d25623.jpg.

i've read documentation on serving static assets it's unclear me settings change. seems either need have jpg produced in different directory, or add together directory list of dirs i'm serving static assets. tried adding path staticfiles_dirs didn't work.

when go directory '/cache/cf/43/', see file 'cf43126f1f961593650b5df4791e329f.jpg' in there?

if so, may returning 404 because using django runserver (not sure if or not). if are, might worth taking @ how serve media files in development mode, https://docs.djangoproject.com/en/1.7/howto/static-files/.

python django installation sorl-thumbnail

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -