美文网首页有价值的收藏
python安装djangp-ueditor后需要注意的事项

python安装djangp-ueditor后需要注意的事项

作者: 追梦人在路上不断追寻 | 来源:发表于2019-05-12 22:28 被阅读3次
python

安装好django-ueditor这个扩展包之后,我们还需要修改一些配置文件,我们才能正常使用ueditor,下面简单介绍下需要修改的内容。

1.修改settings.py配置文件

QINIU_BUCKET = ''

MEIDA_ROOT = os.path.join(BASE_DIR,"media")

MEDIA_URL = '/media/'

2.  安装缺失的包

    pip install shortuuid

   pip install qiniu

3.模型中引入ueditor

  from ueditor import UEditorField

  content = UEditorField("内容",default="")

4. 修改ueditor源码包中的widgets.py文件

将grp.jQuery 替换成 django.jQuery

5.修改路由配置

from web.settings import MEDIA_ROOT

from django.views.static import serve

re_path(r'^ueditor/',include('ueditor.urls')),

re_path(r'^media/(?P<path>.*)$', serve, {'document_root': MEDIA_ROOT})

django-ueditor

相关文章

网友评论

    本文标题:python安装djangp-ueditor后需要注意的事项

    本文链接:https://www.haomeiwen.com/subject/mlghaqtx.html