CKedit图像上载不工作

2024-04-19 04:05:42 发布

您现在位置:Python中文网/ 问答频道 /正文

这是我的urls.py

from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import views
from django.conf import settings

urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/login/$', views.login, name='login'),
url(r'^accounts/logout/$', views.logout, name='logout', kwargs={'next_page':     '/'}),
url(r'^ckeditor/', include('ckeditor_uploader.urls')),
url(r'', include('blog.urls')),
]

settings.py

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
LOGIN_REDIRECT_URL = '/'
MEDIA_URL = '/media/'
CKEDITOR_UPLOAD_PATH = 'uploads/'
CKEDITOR_JQUERY_URL = 'http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'

错误代码

enter image description here

我将上传图像使用CKeditor。 然而,有一个404 error。 我该怎么办?你知道吗


Tags: djangofrompyimporturlsettingsincludeadmin
1条回答
网友
1楼 · 发布于 2024-04-19 04:05:42

要使用开发服务器来传递媒体文件,您的应用程序中需要这样的内容网址.py你知道吗

urlpatterns = [
    # ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

据我所知,Ckeditor不会自动添加,因此您需要将此代码添加到您的网址.py你知道吗

相关问题 更多 >