[Django]-Django Uploaded images not displayed in production

7๐Ÿ‘

โœ…

Your Nginx is not serving the MEDIA_URL i.e. /media/. You need an Nginx configuration section like you have for /static/

  server {
        listen 80;
        server_name <my IP> ;
        location = /favicon.ico { access_log off; log_not_found off; }
        location /static/ {
            root /home/myusername/myproject;
        }
        location /media/ {
            root /home/myusername/myproject;
        }
        location / {
            include proxy_params;
            proxy_pass http://unix:/home/myusername/myproject/myproject.sock;
        }
    }

0๐Ÿ‘

You may need to run this command :
python manage.py collectstatic from the shell of your platform
if you are using heroku here is the command

heroku run python manage.py collectstatic

Leave a comment