pycloudinary icon indicating copy to clipboard operation
pycloudinary copied to clipboard

Set cloudinary url in flask config

Open alexwaters opened this issue 8 years ago • 2 comments

Is there a way to set the cloudinary url in flask config so that we don't have to define it as an env variable?

alexwaters avatar May 10 '16 09:05 alexwaters

Hi @alexwaters, I'm sorry for the response delay. Unfortunately we currently don't have flask integration and therefore don't currently support Flask's configurations.

taragano avatar Aug 23 '16 21:08 taragano

Hi, Just add in your env: CLOUDINARY_URL=cloudinary://your_api_key:api_secret@name

SBillion avatar Dec 04 '17 12:12 SBillion

Hey can you please assign this to me. I want to work on this issue.

parag477 avatar Oct 03 '23 13:10 parag477

Import the cloudinary module and set the Cloudinary URL in your Flask app's configuration. You should have your Cloudinary URL, which you can obtain from your Cloudinary account:

import cloudinary
app.config['CLOUDINARY_URL'] = 'your_cloudinary_url_here'
app.config['CLOUDINARY_API_KEY'] = 'your_api_key_here'
app.config['CLOUDINARY_API_SECRET'] = 'your_api_secret_here'

Then initialize Cloudinary within your Flask app by using the cloudinary.config() method

cloudinary.config(
    cloud_name=app.config['CLOUDINARY_URL'].split('@')[1].split('/')[2],
    api_key=app.config['CLOUDINARY_API_KEY'],
    api_secret=app.config['CLOUDINARY_API_SECRET']
)

parag477 avatar Oct 05 '23 11:10 parag477

Can you please add hacktoberfest label and close this issue as completed.

parag477 avatar Oct 05 '23 11:10 parag477