You can change the upload path of Django Froala Editor to Cloudinary by
using Cloudinary's upload API. Here is an example of how to do this:

Sign up for a Cloudinary account and get your cloud name, API key, and API
secret.

Install the Cloudinary Python library:

settings.py:
===========
pip install cloudinary

Add the following settings in your Django settings file:


import os
import cloudinary
import cloudinary.uploader

CLOUDINARY_CLOUD_NAME = "your_cloud_name"
CLOUDINARY_API_KEY = "your_api_key"
CLOUDINARY_API_SECRET = "your_api_secret"

cloudinary.config(
  cloud_name = CLOUDINARY_CLOUD_NAME,
  api_key = CLOUDINARY_API_KEY,
  api_secret = CLOUDINARY_API_SECRET
)



In your Froala Editor view,
use the Cloudinary library to upload the image and return the URL to Froala
Editor.
Here is an example view:


from django.http import JsonResponse
import cloudinary
import cloudinary.uploader

def froala_upload(request):
    if request.method == 'POST' and request.FILES.get('file'):
        try:
            response = cloudinary.uploader.upload(request.FILES['file'])
            return JsonResponse({
                'link': response['secure_url']
            })
        except Exception as e:
            return JsonResponse({
                'error': str(e)
            })
    return JsonResponse({
        'error': 'Invalid request'
    })



5.

Add the URL for the Froala upload view in your URL configuration:


from django.urls import path
from .views import froala_upload

urlpatterns = [
    path('froala_upload/', froala_upload, name='froala_upload'),
]



6.
In the Froala Editor options, set the imageUploadURL to the URL of your
upload view.
 Here is an example:


$('#froala-editor').froalaEditor({
  imageUploadURL: '/froala_upload/'
});

On Fri, Feb 3, 2023 at 3:58 AM Israel Akinoso <akinosoi...@gmail.com> wrote:

> Can we collaborate on one together?
> It'll boost us both :)
>
> On Wednesday, February 1, 2023 at 4:03:40 PM UTC+1 vinodr...@gmail.com
> wrote:
>
>> Hi All, I am recently complete *Django course* with *small projects*,
>> can any one help me to find *real world projects* to master Django,
>> i have basic knowledge about *UI technologies.*
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e674df39-8626-4403-b294-95ce4f843d57n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e674df39-8626-4403-b294-95ce4f843d57n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPohmQv34_NHtBovu97dfEdEuO2c6J4Z%2B4QgyjYTnUKq56usQQ%40mail.gmail.com.

Reply via email to