google-code-export / django-photologue

Automatically exported from code.google.com/p/django-photologue
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Error retrieving thumbnail in admin interface #81

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Follow installation instructions as shown at
http://code.google.com/p/django-photologue/wiki/ReadMe.
2. Upload a photo in the admin interface. Return to:
http://localhost:8080/admin/photologue/photo/
3. Try to view thumbnail as linked in source
(http://localhost:8080/admin/photologue/photo/photologue/photos/cache/159871_bic
ycle_feet_1_vw_admin_thumbnail.jpg/)

What is the expected output? What do you see instead?

Expected output: Image thumbnail (disk location is
/srv/django/mysite/photologue/photos/cache/159871_bicycle_feet_1_vw_admin_thumbn
ail.jpg)

What I see:

ValueError at
/admin/photologue/photo/photologue/photos/cache/159871_bicycle_feet_1_vw_admin_t
humbnail.jpg/

invalid literal for int() with base 10:
'photologue/photos/cache/159871_bicycle_feet_1_vw_admin_thumbnail.jpg'

Traceback:
Environment:

Request Method: GET
Request URL:
http://localhost:8080/admin/photologue/photo/photologue/photos/cache/159871_bicy
cle_feet_1_vw_admin_thumbnail.jpg/
Django Version: 1.0-final-SVN-unknown
Python Version: 2.6.0
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'photologue']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')

Traceback:
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in
get_response
  86.                 response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/lib/python2.6/site-packages/django/contrib/admin/sites.py" in root
  158.                 return self.model_page(request, *url.split('/', 2))
File "/usr/lib/python2.6/site-packages/django/views/decorators/cache.py" in
_wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/django/contrib/admin/sites.py" in
model_page
  177.         return admin_obj(request, rest_of_url)
File "/usr/lib/python2.6/site-packages/django/contrib/admin/options.py" in
__call__
  197.             return self.change_view(request, unquote(url))
File "/usr/lib/python2.6/site-packages/django/db/transaction.py" in
_commit_on_success
  238.                 res = func(*args, **kw)
File "/usr/lib/python2.6/site-packages/django/contrib/admin/options.py" in
change_view
  557.             obj = model._default_manager.get(pk=object_id)
File "/usr/lib/python2.6/site-packages/django/db/models/manager.py" in get
  93.         return self.get_query_set().get(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/django/db/models/query.py" in get
  297.         clone = self.filter(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/django/db/models/query.py" in filter
  483.         return self._filter_or_exclude(False, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/django/db/models/query.py" in
_filter_or_exclude
  501.             clone.query.add_q(Q(*args, **kwargs))
File "/usr/lib/python2.6/site-packages/django/db/models/sql/query.py" in add_q
  1224.                             can_reuse=used_aliases)
File "/usr/lib/python2.6/site-packages/django/db/models/sql/query.py" in
add_filter
  1167.         self.where.add((alias, col, field, lookup_type, value),
connector)
File "/usr/lib/python2.6/site-packages/django/db/models/sql/where.py" in add
  48.                 params = field.get_db_prep_lookup(lookup_type, value)
File "/usr/lib/python2.6/site-packages/django/db/models/fields/__init__.py"
in get_db_prep_lookup
  202.             return [self.get_db_prep_value(value)]
File "/usr/lib/python2.6/site-packages/django/db/models/fields/__init__.py"
in get_db_prep_value
  353.         return int(value)

Exception Type: ValueError at
/admin/photologue/photo/photologue/photos/cache/159871_bicycle_feet_1_vw_admin_t
humbnail.jpg/
Exception Value: invalid literal for int() with base 10:
'photologue/photos/cache/159871_bicycle_feet_1_vw_admin_thumbnail.jpg'

What version of the product are you using? On what operating system?

>>> photologue.VERSION
(2, 0)

$ uname -r
2.6.27-ARCH [linux]

Please provide any additional information below.

Using a fresh/unmodified Django installation and a totally new project. A
copy of the complete project directory is attached.

Original issue reported on code.google.com by ssadl...@googlemail.com on 11 Nov 2008 at 6:12

Attachments:

GoogleCodeExporter commented 9 years ago
A bit of information I forgot to give, the <img> tag in the admin interface:
<img src="photologue/photos/cache/159871_bicycle_feet_1_vw_admin_thumbnail.jpg">

This tag is returned by Photo.get_absolute_url in
/usr/lib/python2.5/site-packages/photologue/models.py

Original comment by ssadl...@googlemail.com on 11 Nov 2008 at 6:22

GoogleCodeExporter commented 9 years ago
I have resolved this - it was my fault, I had not set MEDIA_URL and MEDIA_ROOT 
in
settings. Sorry if I wasted anyone's time!

Original comment by ssadl...@googlemail.com on 11 Nov 2008 at 7:59

GoogleCodeExporter commented 9 years ago
No worries. It's a common mistake.

Original comment by justin.d...@gmail.com on 11 Nov 2008 at 8:20