Re: Serving cached images using uwsgi/nginx. How ?

165 views
Skip to first unread message

Rob Speed

unread,
Apr 25, 2013, 3:03:27 PM4/25/13
to satchm...@googlegroups.com
Hi Andrew,

Django has two separate settings for "static" files and "media" files. Static files are things you create that are part of the site itself, whereas media files are added to the site as content. Django handles them somewhat differently – particularly the fact that static files need to be collected from multiple sources (using 'manage.py collectstatic') – and therefore has separate settings for each.

You should look up the MEDIA_ROOT and MEDIA_URL settings, and configure Nginx to serve files as MEDIA_URL from whatever path you have set in MEDIA_ROOT. https://docs.djangoproject.com/en/1.4/ref/settings/#media-root

Note: uwsgi isn't involved in this process.

--
Rob Speed
spee...@gmail.com


On Thu, Apr 25, 2013 at 2:42 AM, AndrewLvov <trust...@gmail.com> wrote:
There is a question and a problem, actually )

During deployment, I've collected static files into a folder /opt/project_name/static.
The files began being served normally except cached images. It looks like no matter what I do, some pages contain image urls like mysite.com/media/cache/65/8d/658d063b497b2bd1ea6bf135896566c8.jpg and thus not displayed.
Clearing cache using cache.clear() and ./manage.py thumbnail clear doesn't help. As well as restarting uwsgi, nginx and so on.

Also, I don't understand how satchmo is expected to know where to put cached files, since they are served from /opt/project_name/static folder. Do I need to configure this folder somewhere in settings.py ?

How do I resolve both issues ?

Thank you a lot, stuck with these issues a half of day already (

--
You received this message because you are subscribed to the Google Groups "Satchmo users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to satchmo-user...@googlegroups.com.
To post to this group, send email to satchm...@googlegroups.com.
Visit this group at http://groups.google.com/group/satchmo-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

AndrewLvov

unread,
Apr 26, 2013, 2:09:24 PM4/26/13
to satchm...@googlegroups.com
Rob,

thank you for explaining this - the code is now corrected.

However, could you please help with the issue that left unresolved:
When I open a product page, the url to product image is smth like: mysite.com/media/cache/65/8d/658d063b497b2bd1ea6bf135896566c8.jpg,
and I have no idea how to reset cache to make Satchmo regenerate cached image.
I've tried cache.clear() from django shell, as well as
./manage.py thumbnail clear.

The url still points to the file which doesn't exist. How do I regenerate it ?

четверг, 25 апреля 2013 г., 23:03:27 UTC+4 пользователь Rob Speed написал:

Olivier Lauret

unread,
Apr 28, 2013, 9:16:04 AM4/28/13
to satchm...@googlegroups.com

Hi Andrew,

Two way I'm doing:

  • Complexe one: I'm usually using "python manage.py thumbnail cleanup", then "python manage.py thumbnail clear" and finally I restart the django.
  • Simple one (workaround): download a new image and delete the old one in the same manipulation.

It's not the best, so if you can find an solution, this would be great. I didn't have time yet to look at this issue.

Regards,

Olivier

AndrewLvov

unread,
Apr 29, 2013, 11:33:32 AM4/29/13
to satchm...@googlegroups.com, olivier...@googlemail.com
Thank you a lot, Olivier.

Probably, thumbnail cleanup was required. Executed the commands you've given and the image has been regenerated.

воскресенье, 28 апреля 2013 г., 17:16:04 UTC+4 пользователь Olivier Lauret написал:
Reply all
Reply to author
Forward
0 new messages