S
S
stayHARD2016-07-01 15:00:43
Django
stayHARD, 2016-07-01 15:00:43

Why is the cache folder not being created?

Hello.
There is a project written in Django 1.9.6.
Here's what it outputs pip freeze:

Django==1.9.6
djangorestframework==3.3.3
facebook-sdk==0.4.0
future==0.15.2
Markdown==2.6.6
oauthlib==1.1.2
Pillow==3.2.0
requests==2.10.0
requests-oauthlib==0.6.1
six==1.10.0
sorl-thumbnail==12.4a1
tweepy==3.5.0

From here you can see the version of sorl.thumbnail - sorl-thumbnail.readthedocs.io
Next I do python manage.py migrate
The output is:
Operations to perform:
  Apply all migrations: users, sessions, admin, admin_panel, auth, contenttypes, thumbnail
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin_panel.0001_initial... OK
  Applying admin_panel.0002_auto_20160603_1118... OK
  Applying admin_panel.0003_categories_shop_style_name... OK
  Applying admin_panel.0004_auto_20160616_1356... OK
  Applying admin_panel.0005_auto_20160618_1747... OK
  Applying admin_panel.0006_salesubscriber... OK
  Applying admin_panel.0007_salesubscriber_country... OK
  Applying admin_panel.0008_newssubscriber... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying sessions.0001_initial... OK
<b>  Applying thumbnail.0001_initial... OK</b>
  Applying users.0001_initial... OK
  Applying users.0002_auto_20160607_1222... OK
  Applying users.0003_userprofile_full_name... OK
  Applying users.0004_auto_20160608_1232... OK
  Applying users.0005_userprofile_twitter_id... OK
  Applying users.0006_auto_20160622_1152... OK
  Applying users.0007_outfit_thumbnail... OK
  Applying users.0008_outfit_name... OK
  Applying users.0009_auto_20160630_1147... OK
  Applying users.0010_savedoutfit... OK

As you can see from this, the migration for sorl.thumbnail is OK.
Next, I check the existence of the media folder.
Here is my settings.py by the way:
THUMBNAIL_FORMAT = 'PNG'
THUMBNAIL_DEBUG = True
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
MEDIA_URL = '/media/'

STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, "dev_static"),
)

Then I crop the pictures, I get this on the page:
0a751f0332df4a059b9194ba6f6ee45a.png
I look at the source code of the element:
<img class="draggable" src="/media/cache/23/01/2301f3f921cb0b31116d567088b82f02.png" alt="" data-price="£395" data-name="SEA Gingham cotton-blend gauze midi dress" data-id="512875078" data-link="#" style="">

Naturally, there is no picture along this path, even the cache folder has not been created. I gave permissions to the media folder (which I myself created) 777.
All this happens on a normal EC2 AWS instance. Locally, everything is fine, everything is cut off and saved. The problem arose when transferring to the server.
I would be glad to hear advice, once there was such a problem, but I don’t remember how I solved it.
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel, 2017-12-21
@Pavlmir

This team is here to help!
Re-creates the media/cache folder
python manage.py thumbnail clear

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question