I'm trying to build a platform for trades people and customer to share reviews and post jobs
its a project to help me understand Django, python and how its all linked together
I have a jobs page where you should be able to see the active and inactive jobs along with a picture within a bootstrap card setting
in Django admin the field is there to add image which I have done. however it does not show on my site.
Pillow is installed
MEDIA directory in settings is there
template is there with enctype=multiport/form-data, <img src=> is there
And its still doesn't seem to be there I'm not sure why
Hopefully the images show you enough to help me get this fixed as I feel I have tried everything
In your settings.py, configure your MEDIA_URL and MEDIA_ROOT settings:
import os
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media'
)
Then in your project-level urls.py, add:
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
# ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
This should serve user-uploaded media files in development but it's not suitable for production. You would need a dedicated cloud service provider such as Cloudinary to serve media files in production.