我已经安装了django 1.10。然后是ckeditor 5.0.3 完成配置后,我收到错误“ImportError:No module named urls” 有config settings.py:
INSTALLED_APPS = [
...
'ckeditor',
]
CKEDITOR_UPLOAD_PATH = 'upload/'
有urls.py:
from django.conf.urls import url, include
(r'^ckeditor/', include('ckeditor.urls')),
有ckeditor_uploader的urls.py:
from __future__ import absolute_import
import django
from django.conf.urls import url
from django.contrib.admin.views.decorators import staff_member_required
from django.views.decorators.cache import never_cache
from . import views
if django.VERSION >= (1, 8):
urlpatterns = [
url(r'^upload/',
staff_member_required(views.upload),
name='ckeditor_upload'),
url(r'^browse/', never_cache(staff_member_required(views.browse)),
name='ckeditor_browse'),
]
else:
from django.conf.urls import patterns
urlpatterns = patterns(
'',
url(r'^upload/', staff_member_required(views.upload),
name='ckeditor_upload'),
url(r'^browse/', never_cache(staff_member_required(views.browse)),
name='ckeditor_browse'),
)
请帮忙!
WSGI_APPLICATION:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "blago.settings")
application = get_wsgi_application()
答案 0 :(得分:2)
注意:django-ckeditor 5具有向后不兼容的代码移动4.5.1。
文件上传支持已移至ckeditor_uploader。网址在ckeditor_uploader.urls中,而对于文件上传小部件,您必须使用RichTextUploadingField而不是RichTextField。
...
将
ckeditor_uploader
添加到您的INSTALLED_APPS设置。
...
将CKEditor URL include添加到项目的urls.py文件中:
(r'^ckeditor/', include('ckeditor_uploader.urls')),