django / ImageKit - showing absolute path to images

682 views Asked by At

I'm using the ImageKit and for some reason it's displaying the absolute path to images. Any idea how to make it to display the path I have set in the MEDIA_URL ?

1

There are 1 answers

0
avatar On BEST ANSWER

The problem is in Models with the ImageKit's cache_dir seting. If you put a slash in front of your path and have the absolute path to your images then when you pull the images in your template it will show the absolute path to your images:

cache_dir = '/mymedia/myimages/cache/'

But if you take the front slash off from your path and not include the folder mentioned in MEDIA_URL (in settings.py) then the problem with the reference to the absolute path goes away:

cache_dir = 'myimages/cache/'