I'm trying to create a web app for my final school project and i decided to use CKEditor5 to create rich test posts i managed to integrate Ckeditor with Django and, i can successfully create post from the admin aria and add images but when i wanted to do the same thing from the frontend (react), i faced some problems that i didn't know how to solve .
so when i try to upload an image i recive a popup in the browser with the message ** can't upload the file **
this is my code for the editor (it works just fine with text )
<CKEditor
editor={ClassicEditor}
data=""
onInit={(editor) => {
// You can store the "editor" and use when it is needed.
console.log("Editor is ready to use!", editor);
}}
onChange={(event, editor) => {
const data = editor.getData();
this.setState({ content: editor.getData() });
}}
onBlur={(event, editor) => {}}
onFocus={(event, editor) => {
console.log("Focus.", editor);
}}
config={{
ckfinder: {
// Upload the images to the server using the CKFinder QuickUpload command.
uploadUrl: "http://localhost:8000/media/uploads/",
options: {
resourceType: "Images",
},
},
}}
/>
the url path that i but in the uploadUrl is the path where i put media when using the admin ckeditor that i integrated sepreatly i followed i tutorial to do it
this is the variables that i set in the sittings file
STATIC_URL = '/static/'
STATIC_ROOT = 'static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = 'media/'
CKEDITOR_UPLOAD_PATH = 'uploads/'
so i think that i should not use the same path because i can not POST to this url i get in the local host console an error
Forbidden (CSRF token missing or incorrect.): /media/uploads/
[22/May/2020 08:26:49] "POST /media/uploads/ HTTP/1.1" 403 2513
(i don't use react-create-app server i'm loading react as a django frontend app in port 8000 )