I have a model which contains user_image field. This field has default image value:
user_image = models.ImageField(verbose_name='Аватар',blank=True, default=settings.STATIC_URL+'avatar.jpeg')
after update to django 1.10 this default image doesn't show in templates because link contain wrong path. For example in my case link should be
'127.0.0.0:8000/static/avatar.jpeg'
instead I have link like this
'127.0.0.0:8000/media/static/avatar.jpeg'
Python console outputs
>>>u.userprofiletable_set.get().user_image
<ImageFieldFile: /static/avatar.jpeg>
>>> u.userprofiletable_set.get().user_image.url
'/media/static/avatar.jpeg'
>>> u.userprofiletable_set.get().user_image.path
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Users/korablevop/.virtualenvs/mynewenv/lib/python3.5/site-packages/django/db/models/fields/files.py", line 64, in _get_path
return self.storage.path(self.name)
File "/Users/korablevop/.virtualenvs/mynewenv/lib/python3.5/site-packages/django/core/files/storage.py", line 407, in path
return safe_join(self.location, name)
File "/Users/korablevop/.virtualenvs/mynewenv/lib/python3.5/site-packages/django/utils/_os.py", line 78, in safe_join
'component ({})'.format(final_path, base_path))
django.core.exceptions.SuspiciousFileOperation: The joined path (/static/avatar.jpeg) is located outside of the base path component (/Users/korablevop/PycharmProjects/sxodu/media)