dasdczxc
dasdczxc

Reputation: 33

CKedit image upload not working

This is my 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'

Error code

enter image description here

I will upload image using CKeditor. However, there is a 404 error. What should I do?

Upvotes: 2

Views: 217

Answers (2)

이지은
이지은

Reputation: 1

I have same kind of problems(not exactly the same) you must save your image (static) and deliver the address to CKeditor.

Upvotes: 0

e4c5
e4c5

Reputation: 53734

To use the development server to deliver media files you need something like this in your urls.py

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

As far as I am aware Ckeditor does not add that automatically so you will need to ad this code to your urls.py

Upvotes: 4

Related Questions