{"action":"created","issue":{"url":"https://api.github.com/repos/mariocesar/sorl-thumbnail/issues/397","labels_url":"https://api.github.com/repos/mariocesar/sorl-thumbnail/issues/397/labels{/name}","comments_url":"https://api.github.com/repos/mariocesar/sorl-thumbnail/issues/397/comments","events_url":"https://api.github.com/repos/mariocesar/sorl-thumbnail/issues/397/events","html_url":"https://github.com/mariocesar/sorl-thumbnail/issues/397","id":100168842,"number":397,"title":"Cannot get sorl-thumbnail to work with MEDIA_ROOT set","user":{"login":"qcaron","id":8321628,"avatar_url":"https://avatars.githubusercontent.com/u/8321628?v=3","gravatar_id":"","url":"https://api.github.com/users/qcaron","html_url":"https://github.com/qcaron","followers_url":"https://api.github.com/users/qcaron/followers","following_url":"https://api.github.com/users/qcaron/following{/other_user}","gists_url":"https://api.github.com/users/qcaron/gists{/gist_id}","starred_url":"https://api.github.com/users/qcaron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qcaron/subscriptions","organizations_url":"https://api.github.com/users/qcaron/orgs","repos_url":"https://api.github.com/users/qcaron/repos","events_url":"https://api.github.com/users/qcaron/events{/privacy}","received_events_url":"https://api.github.com/users/qcaron/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-08-10T21:08:17Z","updated_at":"2015-08-16T20:34:45Z","closed_at":null,"body":"Hi there !\r\n\r\nIf I do not set `MEDIA_ROOT` and `MEDIA_URL` in my settings, the static/cache directory gets filled with images. But when settings `MEDIA_ROOT` and `MEDIA_URL` then it does not work anymore.\r\n\r\nI am using Django 1.8.3 and Python 2.7.6 with pipeline 1.5.3. I am testing locally so please note that `DEBUG=True`, `TEMPLATE_DEBUG = DEBUG` and `THUMBNAIL_DEBUG = DEBUG`.\r\n\r\nI have referenced this in a [stackoverflow question](http://stackoverflow.com/questions/31925227/cannot-get-sorl-thumbnail-to-work-with-media-root-set) but I fear I will not get an answer there. So here it is:\r\n\r\nHere are my settings:\r\n\r\n```python\r\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\r\n\r\nDEBUG = True\r\nTEMPLATE_DEBUG = DEBUG\r\n\r\nINSTALLED_APPS = (\r\n    'django.contrib.sites',\r\n    'grappelli',\r\n    'django.contrib.admin',\r\n    'django.contrib.auth',\r\n    'django.contrib.contenttypes',\r\n    'django.contrib.sessions',\r\n    'django.contrib.messages',\r\n    'django.contrib.staticfiles',\r\n    'djangobower',\r\n    'pipeline',\r\n    'sorl.thumbnail',\r\n    'django_countries',\r\n    'allauth',\r\n    'allauth.account',\r\n    'allauth.socialaccount',\r\n    # Local apps\r\n    ...\r\n\r\nSTATIC_ROOT = os.path.join(BASE_DIR, 'static')\r\nSTATIC_URL = '/static/'\r\nSTATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'\r\n\r\nMEDIA_ROOT = os.path.join(BASE_DIR, 'media')\r\nMEDIA_URL = '/media/'\r\n\r\nTHUMBNAIL_DEBUG = DEBUG\r\nTHUMBNAIL_PREFIX = 'cache/'\r\n\r\nSTATICFILES_FINDERS = (\r\n    'django.contrib.staticfiles.finders.FileSystemFinder',\r\n    'django.contrib.staticfiles.finders.AppDirectoriesFinder',\r\n    'pipeline.finders.PipelineFinder',\r\n)\r\n\r\n# TODO : use redis in prod\r\nCACHES = {\r\n    'default': {\r\n        'BACKEND': 'django.core.cache.backends.db.DatabaseCache',\r\n        'LOCATION': 'cache',\r\n    }\r\n}\r\n```\r\n\r\nMy home.html file contains this:\r\n\r\n```html\r\n{% extends 'base.html' %}\r\n\r\n{% load static i18n thumbnail %}\r\n\r\n{% static 'main/img/business_man_in_the_mirror.jpg' as business_man_in_the_mirror %}\r\n{{ business_man_in_the_mirror }}\r\n{% thumbnail business_man_in_the_mirror|slice:\"1:\" \"x300\" as im %}\r\n    {{ im.url }}\r\n    <img src=\"{{ im.url }}\" width=\"{{ im.width }}\" height=\"{{ im.height }}\"\r\n         alt=\"{% trans \"Homme d'affaire se regardant dans le miroir\" %}\"\r\n         class=\"center-block img-responsive\">\r\n{% endthumbnail %}\r\n```\r\n\r\n`{{ business_man_in_the_mirror }}` prints \"/static/main/img/business_man_in_the_mirror.jpg\".\r\n`{{ im.url }}` prints \"/media/cache/d0/38/d038a3e64b2c7d070088e368ee881027.jpg\"\r\n\r\nSo far so good. But the cache folder in MEDIA_ROOT never gets created. The MEDIA_ROOT even has 777 rights. I do not see any error from `./manage.py runserver -v 3`. So the image is missing in my web page.\r\n\r\nThe runserver log shows the following:\r\n\r\n    [10/Aug/2015 18:47:47]\"GET /media/cache/d0/38/d038a3e64b2c7d070088e368ee881027.jpg HTTP/1.1\" 404 2870\r\nhttp://localhost:8000/static/main/img/business_man_in_the_mirror.jpg does show me the image.\r\n\r\nI tried all thumbnail Management Commands but it had no effect. I also tried to delete the tumbnail_kvstore table and the cache table in DB, changed nothing. I have 5 rows in cache table but nothing in thumbnail_kvstore table.\r\n\r\nThanks for your help!!"},"comment":{"url":"https://api.github.com/repos/mariocesar/sorl-thumbnail/issues/comments/131618492","html_url":"https://github.com/mariocesar/sorl-thumbnail/issues/397#issuecomment-131618492","issue_url":"https://api.github.com/repos/mariocesar/sorl-thumbnail/issues/397","id":131618492,"user":{"login":"relekang","id":476364,"avatar_url":"https://avatars.githubusercontent.com/u/476364?v=3","gravatar_id":"","url":"https://api.github.com/users/relekang","html_url":"https://github.com/relekang","followers_url":"https://api.github.com/users/relekang/followers","following_url":"https://api.github.com/users/relekang/following{/other_user}","gists_url":"https://api.github.com/users/relekang/gists{/gist_id}","starred_url":"https://api.github.com/users/relekang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/relekang/subscriptions","organizations_url":"https://api.github.com/users/relekang/orgs","repos_url":"https://api.github.com/users/relekang/repos","events_url":"https://api.github.com/users/relekang/events{/privacy}","received_events_url":"https://api.github.com/users/relekang/received_events","type":"User","site_admin":false},"created_at":"2015-08-16T20:34:45Z","updated_at":"2015-08-16T20:34:45Z","body":"> However, it created a cache folder in my project root directory. \r\n\r\nThat is a bit strange, I would expect it to use the regular cache folder in media."}}