Veronica Andric
Veronica Andric

Reputation: 47

"ImportError: The Python Imaging Library was not found." raised through wsgi.py in Django app using Apache

I am working on a project using Django and am trying to connect it to my Apache server. Here is the traceback for the error I am getting:

mod_wsgi (pid=3325): Target WSGI script '/var/www/Project/project/wsgi.py' cannot be loaded as Python module.
mod_wsgi (pid=3325): Exception occurred processing WSGI script '/var/www/Project/project/wsgi.py'.
Traceback (most recent call last):
File "/var/www/Project/project/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/var/www/Project/venv/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
django.setup()
File "/var/www/Project/venv/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/var/www/Project/venv/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/var/www/Project/venv/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/var/www/Project/venv/lib/python2.7/site-packages/filer/models/__init__.py", line 3, in <module>
from .clipboardmodels import *  # flake8: noqa
File "/var/www/Project/venv/lib/python2.7/site-packages/filer/models/clipboardmodels.py", line 9, in <module>
from . import filemodels
File "/var/www/Project/venv/lib/python2.7/site-packages/filer/models/filemodels.py", line 14, in <module>
from . import mixins
File "/var/www/Project/venv/lib/python2.7/site-packages/filer/models/mixins.py", line 7, in <module>
from ..settings import FILER_ADMIN_ICON_SIZES
File "/var/www/Project/venv/lib/python2.7/site-packages/filer/settings.py", line 11, in <module>
from .utils.loader import load_object
File "/var/www/Project/venv/lib/python2.7/site-packages/filer/utils/loader.py", line 15, in <module>
from .compatibility import import_module
File "/var/www/Project/venv/lib/python2.7/site-packages/filer/utils/compatibility.py", line 95, in <module>
raise ImportError("The Python Imaging Library was not found.")
ImportError: The Python Imaging Library was not found.

Here is my config file:

WSGIPythonPath /var/www/Project:/var/www/Project/venv/lib/python2.7/site-packages
WSGIScriptAlias / /var/www/Project/project/wsgi.py

<Directory /var/www/Project/project>
    <Files wsgi.py>
            Require all granted
    </Files>
</Directory>

I tried running: import PIL and, import Image from PIL in the python shell and got no errors. I am inclined to think that the issue has something to do with my configuration of Apache or mod_wsgi. I don't get any such errors when I run my django app with the command {python manage.py runserver}

Useful info: using CentOS7, Apache 2.4.6, Python 2.7.5, mod_wsgi 3.4 (Please feel free to ask for more info!)

Upvotes: 1

Views: 560

Answers (1)

RL Shyam
RL Shyam

Reputation: 109

Check for PIL on your server where your app is deployed. if not you have to install it.

Upvotes: 1

Related Questions