So i've read the documentations and the solution to this is not included. I've posted this same Question on Quora pending an answer so i decided to ask on here.
My project has features that allows users to upload their profile picture and also make contents that include images like posting thier pictures.
All conditions passes the tescases from the project and no issue seems to be detected but it won't shows media files when hosted on heroku .
From the python file, i'm uploading media files to another media variable in the database, for example
image = database.ImageField( upload_to="media")
and media URLS is defined as
MEDIA_ROOT = "/media/"
MEDIA_URL = os.path.join(os.getcwd(), "media")
The HTML form submitting the media files is written as
<form method="post" enctype="multipart/form-data">
But still, media files won't show up when uploaded on Another server.
A Suggestion would be better but i won't show my backend codes
I'm not sure that you can upload images or say any static assets directly on heroku. Maybe using another storage like Amazon S3 might be of help.
Edit: I found a kind of similar question here https://stackoverflow.com/questions/24642967/can-i-host-images-in-heroku-or-do-i-need-s3
Read the first answer and check the link given at its bottom. This should be helpful
Edit++: Also, one other answer reads:
"If I'm not mistaken, Heroku doesn't allow writes on its filesystem, so, you would not be able to upload a file to your application at Heroku. That's why they suggest you to use and integrate Amazon S3 as a storage option."