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