froala / django-froala-editor

Package to integrate Froala WYSIWYG HTML rich text editor with Django.
https://froala.com/wysiwyg-editor
283 stars 72 forks source link

Cant upload photos #76

Open Borisboky opened 4 years ago

Borisboky commented 4 years ago

I'm trying to use Froala Editor in Django backend but I cant add photos.

In my urls.py in root directory I've added url as follow:

urlpatterns = patterns('',
                       url(r'^$', include('main.urls')),
                       url(r'^froala_editor/', include('froala_editor.urls'))
                       ) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

In setings.py the I have as follows:

STATIC_URL = '/assets/'
STATIC_ROOT = "/var/www/frontend/website/public/"
FRAOLA_EDITOR_THIRD_PARTY = ('image_aviary', 'spell_checker')
FROALA_UPLOAD_PATH = "assets/froala_editor/images"

In models.py I have field as follow:

content = FroalaField(theme='dark')

But when I try to add a photo in django admin I get an error as follows:

"IMAGE CANNOT BE LOADED FROM THE PASSED LINK"

enter image description here

tisdall commented 4 years ago

uploaded files go into MEDIA_ROOT and MEDIA_URL is used to create the url... Have you defined those?

You may want to use the browser's developer console to view what JSON is returned by the upload view and see what the "passed link" says.