in local I have a file in the main directory “media/profiles” where all the images are stored, but in production when I download the code that folder does not exist.
no, I get a 404 error (not found)
when debug=True it returns the url, when debug=False it returns nothing.
Heroku does not preserve user-uploaded media files between dyno restarts. I usually go straight to AWS s3 and is pretty easy to set up. Heroku also has data stores that can be used, but I have yet to try them. Cloudinary is also an option.