使用Apache + Mod_wsgi

时间:2016-06-21 12:19:46

标签: python-2.7 python-imaging-library django-1.6 photologue

我正在尝试在虚拟环境中使用Apache + Mod_wsgi部署Django Inventory。但它提供500服务器端错误声称它无法导入PIL。但是PIL和Photologue已经安装在我的virtualenv中。我在此设置中运行hello-world项目没有任何问题。

仅供参考:当使用pip安装时,Django Inventory本身会作为应用程序安装。并驻留在虚拟环境的站点包中。但是我已经将它复制到了ste包中并将它放在/ var / www / html根目录中以便从apache中提供服务。这可能是个原因吗?

提前致谢。

[Tue Jun 21 10:50:24.308075 2016] [wsgi:error] [pid 19197] [remote ::1:224]   File "/var/www/html/imsenv/lib/python2.7/site-packages/django_inventory/apps/photos/models.py", line 6, in <module>

[Tue Jun 21 10:50:24.308099 2016] [wsgi:error] [pid 19197] [remote ::1:224]     from photologue.models import ImageModel

[Tue Jun 21 10:50:24.308108 2016] [wsgi:error] [pid 19197] [remote ::1:224]   File "/var/www/html/imsenv/lib/python2.7/site-packages/photologue/models.py", line 33, in <module>

[Tue Jun 21 10:50:24.308131 2016] [wsgi:error] [pid 19197] [remote ::1:224]     raise ImportError('Photologue was unable to import the Python Imaging Library. Please confirm it`s installed and available on your current Python path.')

[Tue Jun 21 10:50:24.308170 2016] [wsgi:error] [pid 19197] [remote ::1:224] ImportError: Photologue was unable to import the Python Imaging Library. Please confirm it`s installed and available on your current Python path.

1 个答案:

答案 0 :(得分:0)

这可能不是您正在寻找的答案,但是......

Django-photologue 2.3是一个真正旧版本 - 大约6岁。

安装PIL通常很麻烦;自2012年以来,我就是Django-photologue的维护者,为了正确导入PIL,我必须编写一些丑陋的代码(安装路径往往会从安装变为安装)。我认为在2.6版本中我进行了这些更改。

现在每个人都只使用Pillow: - )

顺便说一句,我查看了the requirements file for django-inventory并使用了非常旧的第三方软件。例如,Django 1.6 - 不再受支持。