我按照以下步骤在mywebsite中设置tinymce:
python -m pip install django-tinymce4-lite
'tinymce'
TINYMCE_DEFAULT_CONFIG
path('tinymce/', include('tinymce.urls')),
中的{li> urls.py
最后
from tinymce import TinyMCE
class TinyMCEWidget(TinyMCE):
def use_required_attribute(self, *args):
return False
class BlogForm(forms.ModelForm):
title = forms.CharField()
content = forms.CharField(
widget=TinyMCEWidget(
attrs={'required': False, 'cols': 30, 'rows': 10}
)
)
image = forms.ImageField()
class Meta:
model = BlogPost
fields = [
'title',
'content',
'image'
]
运行服务器后,它没有显示任何错误并且无法正常工作,请帮助我修复它,谢谢。