我尝试使用Django-machina 0.5作为django-1.11.5上方的论坛实现。
这一行
from PIL import Image as PILImage
在Django-machina 0.5中不起作用
但是在我的Python解释器中工作(这意味着我的Pillow == 4.0.0很好)
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image as PILImage
>>>
我的错误信息如下
(skyenv) D:\prj\skyenv\feldman2017>python manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0432E978>
Traceback (most recent call last):
File "D:\prj\skyenv\lib\site-packages\machina\core\compat.py", line 13, in <module>
from PIL import Image as PILImage
ModuleNotFoundError: No module named 'PIL'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\prj\skyenv\lib\site-packages\machina\core\compat.py", line 17, in <module>
import Image as PILImage # noqa
ModuleNotFoundError: No module named 'Image'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\prj\skyenv\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "D:\prj\skyenv\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run
autoreload.raise_last_exception()
File "D:\prj\skyenv\lib\site-packages\django\utils\autoreload.py", line 251, in raise_last_exception
six.reraise(*_exception)
File "D:\prj\skyenv\lib\site-packages\django\utils\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "D:\prj\skyenv\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "D:\prj\skyenv\lib\site-packages\django\__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "D:\prj\skyenv\lib\site-packages\django\apps\registry.py", line 108, in populate
app_config.import_models()
File "D:\prj\skyenv\lib\site-packages\django\apps\config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "D:\prj\skyenv\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "D:\prj\skyenv\lib\site-packages\machina\apps\forum\models.py", line 5, in <module>
from machina.apps.forum.abstract_models import AbstractForum
File "D:\prj\skyenv\lib\site-packages\machina\apps\forum\abstract_models.py", line 15, in <module>
from machina.core.compat import slugify
File "D:\prj\skyenv\lib\site-packages\machina\core\compat.py", line 21, in <module>
_('Neither Pillow nor PIL could be imported: {}').format(err)
django.core.exceptions.ImproperlyConfigured: Neither Pillow nor PIL could be imported: No module named 'Image'
requirements.txt
appdirs==1.4.2
beautifulsoup4==4.5.3
boto==2.46.1
brotlipy==0.6.0
cffi==1.9.1
Collectfast==0.2.3
defusedxml==0.4.1
dj-database-url==0.4.2
Django==1.11.5
django-allauth==0.30.0
django-appconf==1.0.2
django-classy-tags==0.8.0
django-cleanup==0.4.2
django-crispy-forms==1.6.1
django-easy-maps==0.9.3
django-haystack==2.4.1
django-machina==0.5.6
django-mptt==0.8.7
django-redis-cache==1.6.5
django-registration==2.2
django-smartfields==1.0.9
django-storages-redux==1.3
django-widget-tweaks==1.4.1
geopy==1.11.0
glob2==0.5
gunicorn==19.6.0
lxml==3.7.3
markdown2==2.3.4
mistune==0.7.1
oauthlib==2.0.1
olefile==0.44
packaging==16.8
pillow==4.0.0
psycopg2==2.6.2
pycparser==2.17
pyparsing==2.1.10
python-dateutil==2.6.0
python-http-client==2.2.1
python3-openid==3.0.10
pytz==2016.10
redis==2.10.5
requests==2.13.0
requests-oauthlib==0.7.0
sendgrid==3.6.3
six==1.10.0
virtualenv==15.1.0
Wand==0.4.4
whitenoise==3.3.0
Whoosh==2.7.0