установить подушку с помощью pip install pillow
установить sorl-миниатюру с помощью pip install
sorl.thumbnail вставить 'sorl.thumbnail', в INSTALLED_APPS для файла настроек вставить {% load thumbnail%}
в мой (. html) файл и вставить:
{% thumbnail my class.image "100x100" crop="center" as im %}
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
{% endthumbnail %}
НО
когда
python manage.py makemigrations
ОШИБКА
(my virtualenv) e:\my file\my site\my project>python manage.py showmigrations
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "E:\my file\my site\my virtualenv\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "E:\my file\my site\my virtualenv\lib\site-packages\django\core\management\__init__.py", line 377, in execute
django.setup()
File "E:\my file\my site\my virtualenv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "E:\my file\my site\my virtualenv\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "E:\my file\my site\my virtualenv\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "E:\my file\my site\my virtualenv\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "E:\my file\my site\my virtualenv\lib\site-packages\sorl\thumbnail\models.py", line 2, in <module>
from django.utils.encoding import python_2_unicode_compatible
ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (E:\my file\my site\my virtualenv\lib\site-packages\django\utils\encoding.py)
пожалуйста, помогите мне