The problem with thumbnail

4 views
Skip to first unread message

nttdocomo

unread,
Jul 3, 2009, 10:55:53 AM7/3/09
to Satchmo users
I downloadED the latest development version of Satchmo, and installed
it follow the document in the Satchmo project website. But I
encountered a problem the same as #495, in the store website the
tumbnail url is a absolute path. I don't know is it a bug or there is
some the wrong in my setting. Is there anyone can help me?

python 2.62
Django 1.1 beta
Satchmo 0.9 pre

nttdocomo

unread,
Jul 4, 2009, 5:15:46 AM7/4/09
to Satchmo users
In the website, the thumbnail src is "/static/d:/project/mystore/
static/images/productimage-picture-default_jpg_85x85_q85.jpg", in the
database table, the value is "d:/project/mystore/static/images/
productimage-picture-default_jpg_85x85_q85.jpg".

Is there anyone knows what happend?

Simon

unread,
Jul 4, 2009, 6:02:43 AM7/4/09
to satchm...@googlegroups.com
I had this problem too, I ignored it at the beginning and now it is gone. I am not sure what got rid of the problem but my guess is it's settings related. Most likely MEDIA_URL and/or MEDIA_ROOT. But there has also been allot of other changes to my code base. I.e tracking Django Trunk through a number of sprints.

2009/7/4 nttdocomo <nttdoco...@gmail.com>

nttdocomo

unread,
Jul 4, 2009, 9:10:55 AM7/4/09
to Satchmo users
I haved compare with the correct initial data with mine, and find it
in the product_productimage table, the picture field save a "images/
XX.jpg" in the correct one and in my table it save "d:/projct/mystore/
static/images/XX.jpg". what's going on?

nttdocomo

unread,
Jul 5, 2009, 12:02:06 AM7/5/09
to Satchmo users
I think I got the point. In the Satchmo_utils\thumbnail\utils.py,
there is 258:

if path.startswith(media_root):
path = path[len(media_root):]
if path[0] == '/':
path = path[1:]
the value of "path" is "d:\project\mystore\static\images"., and the
value of "media_root" is "D:\project\mystore\static". that is the
point.

if path.startswith(media_root):
path = path[len(media_root):]

it means that path = \images. Because the value of path and
media_root, the path is not startswith media_root. so it use "d:
\project\mystore\static\images" to store the thumbnail path in the
product_productimage table.

And I think what make it different?

nttdocomo

unread,
Jul 5, 2009, 12:43:30 AM7/5/09
to Satchmo users
Now I change:

media_root = os.path.normpath(settings.MEDIA_ROOT)
if path.startswith(media_root):
path = path[len(media_root):]
if path[0] == '/':
path = path[1:]

to:

media_root = os.path.normpath(settings.MEDIA_ROOT)
if path.startswith(media_root.lower()):
path = path[len(media_root)+1:]
if path[0] == '/':
path = path[1:]

it is work find

Simon

unread,
Jul 5, 2009, 2:48:34 AM7/5/09
to satchm...@googlegroups.com
On some filesystems /mnt/MediaFiles is not the same as /mnt/mediafiles on others it is.

2009/7/5 nttdocomo <nttdoco...@gmail.com>

nttdocomo

unread,
Jul 6, 2009, 5:15:19 AM7/6/09
to Satchmo users
Can you tell me how to fixed this problem?

Simon

unread,
Jul 6, 2009, 12:30:51 PM7/6/09
to satchmo-users
I can't tell you exactly how to fix the problem as I have not deployed Django on windows. But you should look into why path is set to d:\proj.... and not D:\proj....

Also in a number of places in the Django settings docs it says that on windows you should use / and not \ in you paths. Not sure if that applies here.

You could try setting settings.MEDIA_ROOT to d:\proj...

2009/7/6 nttdocomo <nttdoco...@gmail.com>
Reply all
Reply to author
Forward
0 new messages