我正在使用Django 1.10和python 3.4。以下是django_markdown github page
建议的设置settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_markdown',
'blog',
]
urls.py
urlpatterns = [
url(r'^blog/', include('blog.urls')),
url(r'^admin/', admin.site.urls),
url('^markdown/', include( 'django_markdown.urls')),
]
models.py
from django_markdown.models import MarkdownField
class Post(models.Model):
title = models.CharField(max_length=50)
#..
content = MarkdownField()
管理文本编辑器内部如下所示: