Django项目—day3

 
 
 
 
 
问题详细: 
model.py里面使用了富文本编辑器,在执行python manage.py makemigrations的时候报错如下,

File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "F:\tianitian\df_goods\models.py", line 2, in <module>
    from DjangoUeditor.models import UEditorField
  File "C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\DjangoUeditor\models.py", line 4, in <module>
    from widgets import UEditorWidget,AdminUEditorWidget
ImportError: No module named 'widgets'

问题定位:
      Ueditor HTML编辑器是百度开源的HTML编辑器,但是在Python3下调用报错,找不到widgets模块,经查发现,DjangoUeditor是基于Python 2.7的,对Python3的支持有问题。导致widgets.py文件出错,不能import。
 
解决方法:
     使用博主的Ueditor文件(来源github上修改好的版本DjangoUeditor3),点击下载(内附教程)
 

猜你喜欢

转载自www.cnblogs.com/ftl1012/p/10387556.html