1、pip install django-tinymce
2、把安装的tinymce复制到django项目static目录下
3、settings.py
#关闭调试模式后django无法使用静态文件,需要配合nginx使用静态文件
DEBUG = True
STATIC_URL = '/static/'
#写入存放有静态文件的目录,可以写绝对路径也可写相对路径
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
'app1/static',
'app2/static',
]
]
edit_page.html
<head>
<meta charset="UTF-8">
<title>编辑博客页面</title>
<script type="text/javascript" src="/static/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
'mode':'textareas',
'theme':'advanced',
'width':'800',
'height':'600',
})
</script>
</head>
article.html
{% autoescape off %}
{{ article.content }}
{% endautoescape %}
参考
https://blog.csdn.net/zhangruixia0108/article/details/51206152
http://www.cnblogs.com/gcgc/p/9206449.html
https://www.cnblogs.com/zhming26/p/6163952.html