Estoy ejecutando Django 1.4
y PIL 1.1.7
en un virtualenv
administrado con pip
. Cada vez que subo un archivo JPEG a través de mi interfaz de administración, me sale el siguiente error: Upload a valid image. The file you uploaded was either not an image or a corrupted image.
Hacer que Django reconozca el soporte de PIL JPEG
Como muchos usuarios de Ubuntu han informado, en la instalación, PIL erronously veía en /usr/lib/
para libjpeg
, mientras que su verdadera ubicación estaba en /usr/lib/i386-linux-gnu/
. Eso está resuelto; Seguí las respuestas en estos mensajes:
Why can't I upload jpg files to my Django app via admin/?
Ahora el resultado final de la instalación es el siguiente:
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version 1.1.7
platform linux2 2.7.3 (default, Apr 20 2012, 22:44:07)
[GCC 4.6.3]
--------------------------------------------------------------------
--- TKINTER support available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
*** LITTLECMS support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.
To check the build, run the selftest.py script.
changing mode of build/scripts-2.7/pilfile.py from 644 to 755
changing mode of build/scripts-2.7/pilfont.py from 644 to 755
changing mode of build/scripts-2.7/pilconvert.py from 644 to 755
changing mode of build/scripts-2.7/pilprint.py from 644 to 755
changing mode of build/scripts-2.7/pildriver.py from 644 to 755
changing mode of /usr/local/bin/pilfile.py to 755
changing mode of /usr/local/bin/pilfont.py to 755
changing mode of /usr/local/bin/pilconvert.py to 755
changing mode of /usr/local/bin/pilprint.py to 755
changing mode of /usr/local/bin/pildriver.py to 755
Successfully installed PIL
Sin embargo, Django todavía doesn No me permite subir nada excepto archivos BMP, lo cual no es aceptable para este proyecto. A diferencia del usuario en el segundo enlace, no estoy usando Apache, por lo que mi problema probablemente no esté relacionado. Mi sospecha es que Django todavía está usando una antigua instalación de PIL. El problema es que no sé de dónde podría obtenerlo. Los archivos en ~/.virtualenvs/project/local/lib/python2.7/site-packages
me parecen actualizados. ¿Algunas ideas?
EDIT 1: También en cuenta que he intentado cerrar la sesión ya ingresar de nuevo el administrador, así como la instalación pillow
, como en este post: Uploading a JPEG image via Django displays error
¿Intentó instalar [Pillow] (http://pypi.python.org/pypi/Pillow) en lugar de PIL? Compruebe su sys.path – jterrace
¿Podría subir su modelo? – nicowernli
@jterrace: Sí. Y esa instalación también me dijo que el soporte JPEG estaba disponible. – novembrine