Sanj12 commited on
Commit
a6edc9e
·
verified ·
1 Parent(s): 89e5c14

Update cloudinary_utils.py

Browse files
Files changed (1) hide show
  1. cloudinary_utils.py +11 -7
cloudinary_utils.py CHANGED
@@ -2,14 +2,18 @@ import os
2
  import cloudinary
3
  import cloudinary.uploader
4
 
5
- # No need for load_dotenv()
 
 
 
 
 
 
6
 
7
- cloudinary.config(
8
- cloud_name=os.environ.get("CLOUD_NAME"),
9
- api_key=os.environ.get("API_KEY"),
10
- api_secret=os.environ.get("API_SECRET"),
11
- )
12
 
13
- def upload_to_cloudinary(filepath):
14
  response = cloudinary.uploader.upload(filepath)
15
  return response.get("secure_url")
 
2
  import cloudinary
3
  import cloudinary.uploader
4
 
5
+ def upload_to_cloudinary(filepath):
6
+ # Move config INSIDE the function
7
+ cloudinary.config(
8
+ cloud_name=os.environ.get("CLOUD_NAME"),
9
+ api_key=os.environ.get("API_KEY"),
10
+ api_secret=os.environ.get("API_SECRET"),
11
+ )
12
 
13
+ # Debug: check if env vars are loaded
14
+ print("CLOUD_NAME:", os.environ.get("CLOUD_NAME"))
15
+ print("API_KEY:", os.environ.get("API_KEY"))
16
+ print("API_SECRET:", os.environ.get("API_SECRET"))
 
17
 
 
18
  response = cloudinary.uploader.upload(filepath)
19
  return response.get("secure_url")