In Django When Debug is false Images are not Loading I am Using Aws Server

25 Views Asked by At

I tried to deploy my Django web app. In debug mode, everything works fine, but when I change that, the uploaded images are not loading. I am using AWS.

I tried this in my project URLs :

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

It does not work. Here is my settings configuration:

STATIC_URL = "/static/"
STATICFILES_DIRS = [BASE_DIR / "static"]  
STATIC_ROOT = BASE_DIR / "staticfiles"

# Media files (files, Images)
MEDIA_URL = '/goldsouk/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')`

When I inspect an image in website, this is the URL: https://www.goldzouq.com/goldsouk/media/brand/prince.svg

0

There are 0 best solutions below