2017-01-24 1 views
1

Je travaille sur un projet utilisant Django et j'essaie de le connecter à mon serveur Apache. Voici le retraçage de l'erreur que je reçois:"ImportError: la bibliothèque d'imagerie Python n'a pas été trouvée." soulevé via wsgi.py dans l'application Django en utilisant Apache

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. 

Voici mon fichier de configuration:

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> 

J'ai essayé de courir: importation PIL et, import Image de PIL dans le python shell et n'a pas d'erreurs. Je suis enclin à penser que le problème a quelque chose à voir avec ma configuration d'Apache ou de mod_wsgi. Je ne reçois pas de telles erreurs lorsque j'exécute mon application django avec la commande {python manage.py runserver}

Utilisation de CentOS7, Apache 2.4.6, Python 2.7.5, mod_wsgi 3.4 (Veuillez ressentir libre de demander plus d'informations!)

Répondre

1

Vérifiez pour PIL sur votre serveur où votre application est déployée. sinon, vous devez l'installer.