Coder Social home page Coder Social logo

djangowangeditor's Introduction

wangEditor-django

使用方法:

进入项目根目录,执行下面命令将项目文件下载下来

git clone https://github.com/PencilCl/DjangoWangEditor.git

或者下载zip文件

再将文件解压到项目根目录

####接下来进行设置相关配置

DjangoWangEditor添加进项目的INSTALLED_APPS下面

INSTALLED_APPS = [
    ...

    'DjangoWangEditor',
    
    ...
]

然后继续在该settings.py文件中添加设置STATIC_ROOTMEDIA_ROOT如:

import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

####注:编辑器上传的图片将存放在MEDIA_ROOT下的upload文件夹,如需存放到其他文件夹自行修改本项目下的views.py相关代码和settings.py的OUTPUT_PATH
#####现在可以执行下面代码将相关静态文件移动到STATIC文件夹下

python manage.py collectstatic

然后在urls.pyurlpatterns中添加一行

url(r'^wangeditor/', include('DjangoWangEditor.urls')),

####这样基本就完成了 使用该编辑器只需将你的项目原本定义的TextField更改成WangEditorField即可

WangEditorField通过下面代码引入

from DjangoWangEditor.models import WangEditorField

####编辑器的初始化配置等信息在本项目下的templates/wangeditor.html

djangowangeditor's People

Contributors

leenchen0 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.